Years ago I noticed I was getting little bugs in the flour that I kept in the pantry. To prevent this, I started keeping my flour in the freezer. I don't do a lot of baking, but I was wondering what effects this might have on anything I do bake.

Do baked goods turn out any differently when flour is kept in the freezer vs flour kept at room temperature? Also, if it's okay to freeze flour, how long will it last this way?

For longer storage, keep white flours in the refrigerator in an
airtight container. All-purpose and bread flour will keep up to two
years at 40 F in your refrigerator, according to the Wheat Foods
Council. They can be stored indefinitely in the
freezer.

Short answer, yes provided you emphasize the airtightness of your storage container.

I often trust the wisdom espoused on the forums of King Arthur Flour's website, and specifically this topic on freezing flour. All commenters who report personal anecdotes with freezing flour report positive ones. The one note that should be made is that

self-rising flour could lose some effectiveness if frozen, "thawed",
refrozen, etc due to the moisture changes.

Also note that if you remove the cold flour from the freezer and let it sit at room temperature it will gather moisture from the air because of its temperature (ala a cold glass of water gathering condensation.)

I know this is a little late, but IMHO, you should never store any flour, pancake mix or corn meal in its original package. That's the easiest way for bugs to get in. Always store it in airtight containers (such as Tupperware or something like it). Someone once recommended using glass mason jars with a good lid. I always cut the date from the paper package and place that on the top of the flour (that I've stored in Tupperware) so I can see at a glance when the best by date really is. If you really don't use a lot of flour, freeze some and date it. It will be fresh for months. Hope this helps.

I also get pantry moths and worms from time to time. The solution is to go to your local all purpose hardware/garden suppy and ask for the pantry pest moth traps. The traps work very well, and last for 3 months at which time I simply put in a fresh trap.
This is a good idea in addition to putting your flour in the freezer because the pests will simply migrate to another source of food in your cupboard.