Fresh garlic and oil are a dangerous combination if left at room temperature.
Because of garlic’s low acidity and oil’s lack of oxygen, they can cause botulism toxin to develop. However, peeled cloves of garlic can be added to oil and stored in the freezer for several months.
Commercially prepared garlic in oil contains a preservative to increase the acidity of the mixture and keep it safe. To make garlic-flavored oil at home, add dehydrated garlic to olive oil in a wide mouth jar, screw on the lid, and place the jar in the refrigerator. If the olive oil turns solid, just spoon it out. Be careful, however, to always use a dry spoon.