In some indistries, that means thousands of people without work, and hundreds of other companies in the supply chain going bankrupt, and even more people without work. Sometimes it's cheaper to bail out the main company, then to deal with the unemployed, many more bankrupt companies etc.
But some regulation should be put in place... if a CEO fscked up the company so much, it needed government bailout, they don't deserve a bonus, no matter what their contract says. A good system would also be, to turn a bailout into a 'long-term loan' from the government, and have a mandatory percentage of the companies profits go to repaying the 'loan', with some regulation on internal business (to prevent dumping everything to a new, 'clean' company, and letting the old shell fail).