Probably the pH was not low enough and/or the sugar content was too high. The recommended way to make vinegar has 2 steps:
turning the sugars into alcohol through yeast: this is an anaerobic process, so mold should not be a problem (mold needs oxygen) if you install the airlock properly (note: the link above does not mention the airlock, but I highly ...
Fruit flies don't carry human diseases.
They are ok. When they walk on things we want to eat, we can still eat those things. The things don't turn bad. Really, even if the fruit are full of larvae they are still not poison. If you are hungry you can still eat them.
If the vinegar has been sitting for 6 months there are no other flies. Try a little. If ...
I suspect that because you made the vinegar you are preferring to err on the side of caution. Due to the acidity the vinegar is likely safe for consumption, but if you are concerned about that I recommend using it for non edible purposes. You could use it for cleaning, herbicide, or as you have found trapping bugs!
I see no reason to throw it away.