Fresh Herbs in Olive Oil
We have a nice herb garden on our back deck. A few weeks ago, after a visit to a local restaurant, I decided to put a sprig of fresh rosemary into one of our olive oil bottles to create a flavored oil. I cut a sprig, washed it and dried it off, and inserted into the oil bottle. Within a few days, the flavor had permeated the oil well and it was delicious. Unfortunately, I forgot to keep the oil above the rosemary and the top of the stalk grew mold, so I had to discard all of the oil and thoroughly wash the bottle, which I then just refilled with good oil, no spices.
However, I did really like the oil, so before I do it again, is there any secret or warnings other than "don't let the rosemary leaves get exposed to the air above the oil"? Is it going to grow something funky even submerged in the oil? How long should it keep? Would it be better to tightly cork the bottle (it has one of those dispenser spouts now, like a liquor bottle)? Should I dry the rosemary first? Treat it in any way?
Any advice would be appreciated.