In my view, curtailing Russian expansion is the point of the war, and Ukrainian lives are unfortunately one cost of doing so. It's important that Ukrainians are participating in the war of their own volition; the US is not paying Ukrainians to join the battle, unlike the scenario with the ANA in Afghanistan.
Even if the leak produces good outcomes, it should still be prosecuted as espionage, since there was no good faith motivation for the leak.