The government is clearly of the opinion that they can and should prosecute people for leaking information which could cause possible harms.
I’m clearly not a lawyer, but these scenarios seem pretty similar to my untrained eye.
I've been through quite a bit of training and held my clearance for years. I was a victim of the OPM hack. Well, I guess I still am a victim. Mens rea doesn't really apply when handling classified material/data. If it is accidental AND you report it properly, it's not jail - you are so losing your job, however. You also lose your clearance. It has been a while, but I'm pretty sure you lose it forever.