Be careful with your autumn treats. (istock)

If you're planning to enjoy a delicious caramel apple this fall, it might be smart to eat it fresh -- or pop it in the fridge for safe keeping.

In 2014, an outbreak of the bacteria Listeria monocytogenes infected 35 people, killing seven and causing one miscarriage. It was ultimately linked to pre-packaged caramel apples. But since neither hot caramel nor raw apples are typical breeding grounds for the dangerous bacteria, researchers set out to figure out how the outbreak could have occurred. In a study published Tuesday in the journal mBio, researchers from the University of Wisconsin-Madison's Food Research Institute conclude that the sticks used to dip caramel apples are the most likely culprit, and that apples stored at room temperature pose the highest risk.

[Executive who shipped tainted peanuts gets 28 years; 9 died of salmonella]

The study found that apples with dipping sticks inserted were much more likely to facilitate Listeria growth. The researchers believe that the act of inserting the stick causes juice to leak to the surface, which creates a microscopic environment between the caramel and apple where bacteria can thrive.

When apples were left unrefrigerated, the researchers report, this growth happened even more quickly.

It's important to note that these apples in the study were deliberately covered in Listeria before being prepared. The bacteria have to come from somewhere, and if you're using well-washed apples in a reasonably clean kitchen, there's probably no reason to worry. But it might be worth thinking twice about the origin of a store-bought caramel apple.

And if you decide to store your homemade apples in the fridge just to be safe, remember to let them warm up a bit before biting in -- or you're likely to trade Listeria risk for a chipped tooth.

Read More:

Why is the Halloween Whopper turning poop green? A Washington Post investigation.

These friendly food scientists want to make you feel good about eating chemicals

Whole milk is okay. Butter and eggs too. What’s next — bacon?

No, MSG isn’t bad for you