Although, flavored oils capture the fresh quality of herbs they do not preserve the herbs. The oil acts only as a flavor carrier. When making homemade oils it is important to take precautions to prevent botulism. Botulism is a type of food poisoning which is potentially deadly. It is present in soil and carried into our kitchens on garden produce such as vegetables, herbs and garlic, as well as clothing and hands. It thrives in a moist, low acid environment, absent of air and in a temperature range of 21 degrees C (70 degrees F) to 43 degrees C (110 degrees F). The botulism bacteria is destroyed at 100 degrees C (212 degrees F). However, if it produces spores they are not destroyed until they are subjected to a temperature of 116 degrees C (240 degrees F) for a substantial period of time.
Several articles and books recommend adding the herbs to the oil and then placing the jar in a sunny window for a month to develop the flavor. This would create the perfect environment for the development of botulism. Through careful preparation and continuous refrigeration, flavored oils are perfectly safe.
Health Canada recommends that homemade flavored oils always be refrigerated and should be used with in 2 to 3 days if using the cold infusion method or within 1 week for the warm infusion and 1 month for the oven method. If accidentally left out at room temperature flavored oils and pesto should be discarded and a fresh batch made. The Canola Information Service recommends making small batches and labeling each with the date and "keep refrigerated" instructions.
Commercial garlic-in-oil mixtures are acidified to prevent bacterial growth. These products can be stored safely at room temperature. Unfortunately, acidification of homemade flavored oils can't be recommended until more research is conducted.