What is the goal? It doesn't make the code safer. The AES key it is encrypted under is sitting in memory exposed. And the original private key wasn't zeroed anyways.
Best practice is to read a passphrase from the user, decrypt an encrypted key, and hold in memory... but zero the passphrase right after using it, and zero the decrypted key before the program exits. If the program crashes, oops, it could leak. But the program must have the key, so that is the best that you can do without e.g. a hardware device or a remote signer of some kind.
