Most of the Bad code is a result of companies using proprietary software. In the Open source environment, proper Peer review are done, before the code is submitted and applied. Some of these companies are in such a rush to be "first to market" that they skip beta testing and review. They want to be "first to market" and then patch like cowboys in a live environment.

This is why Bitcoin is so secure. Nothing is rushed, proper testing is done on a TestNet and submitted for Peer review. We saw what happened with rush implementation with Bitcoin XT.