We’ve all seen examples of companies that spend aggressively in order to grow, rack up debt and then see that debt become a crushing load when their plans don’t pan out.

On the face of it, iHeartMedia might look like one of those companies. It recently had to concede in an SEC filing that its more than $20 billion in obligations is so crippling that it may not make it to 2018 without having to file for bankruptcy — something that’s seemed like an inevitability for some time.

Yet iHeart debt troubles are not due to profligate spending, but rather the result of a buyout almost 10 years ago. In fact, iHeart’s business performance has been fairly impressive.

Despite operating in two industries in decline — radio and outdoor advertising — iHeart has managed to maintain revenues while improving margins. Its concerts and events, as well as its strength in apps, sponsorships and licensing, have helped its radio business, which also has gotten a boost from political ad spending. The outdoor advertising business has performed pretty well, with digital billboards, higher occupancy on existing billboards and growth across a number of international markets.

sources: iHeartmedia reporting, jackdaw research analysis

Revenue for the company has remained almost entirely stable for the past five years, clocking in at $6.2 billion to $6.3 billion consistently during that period. And operating margins have improved over the past three years, rising from 16% to 24%.

That compares favorably with CBS Radio, which saw stable to slightly declining revenues over the past few years. Operating margins were in the high 20s, very similar to where iHeart was last year.

But iHeart’s debt overshadows the company entirely. Interest expense alone has risen from 25% to 30% of revenue over the past five years, wiping out operating profits and plunging net margins into the red.

sources: iHeartmedia reporting, jackdaw research analysis

From a creditor or investor perspective, of course, none of that matters. iHeart has debt payments due in the coming months that could eat up all its remaining cash and then some, and future years have much higher repayment obligations.

But if iHeart survives its inevitable bankruptcy and restructuring with a more manageable debt load, it could easily become a pretty attractive asset, either as a new public company or as a potential acquisition target. Its broad reach across traditional radio and digital audio as well as a growing presence in outdoor advertising across lots of international markets would be an attractive addition for a number of companies.

So, although CEO Bob Pittman and the rest of the executive team at iHeart could end up taking the blame for failing to turn around the company’s financial performance, it’s quite possible they’ve actually set up the firm to be much more successful after the dust from the bankruptcy settles.

Jan Dawson is the founder and chief analyst at Jackdaw Research, an advisory firm for the consumer technology market.