Most of these didn't end with lives ruined. With Ryan Lanza, the media corrected the suspect name very quickly. Hatfill got a multimillion dollar settlement from the government, and Jewell ended up on SNL. In all cases the media did learn they were wrong and publicly admit. Certainly they jumped the gun and caused injury, but they did learn and do the right thing eventually.
I don't think that's fair to say either. "The media" reports hundreds of names in various capacities every day. Of course they blunder occasionally. You just don't hear about the 99.999% of the time they don't.
I don't think they needed to learn anything. They know it's bad to jump the gun. You still see "Dewey Defeats Truman" jokes.
They just make mistakes. It's easy to criticize a nameless faceless concept like "the media". Individuals in the media are largely upstanding people trying to do the right thing.