1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-01 22:28:02 +02:00

gpg: release DEK soon after its use.

* g10/keygen.c (generate_subkeypair): Release DEK soon.

--

This fixes the out_of_core error in the test case of adding
RSA-4096 subkey to RSA-4096 primary key with configuration:

    s2k-cipher-algo S10

Debian-bug-id: 772780

Cherry-picked da66ad5bba from
STABLE-BRANCH-1-4 branch.
This commit is contained in:
NIIBE Yutaka 2014-12-12 17:41:56 +09:00
parent 4e03e27575
commit 4f0d526b7d

View File

@ -3839,6 +3839,7 @@ generate_subkeypair (KBNODE pub_keyblock, KBNODE sec_keyblock)
if (!rc)
rc = do_create (algo, nbits, pub_keyblock, sec_keyblock,
dek, s2k, &sub_sk, cur_time, expire, 1 );
xfree (dek);
if (!rc)
rc = write_keybinding (pub_keyblock, pub_keyblock, pri_sk, sub_sk,
use, cur_time);
@ -3855,7 +3856,6 @@ generate_subkeypair (KBNODE pub_keyblock, KBNODE sec_keyblock)
if (rc)
log_error (_("Key generation failed: %s\n"), g10_errstr(rc) );
xfree (passphrase);
xfree (dek);
xfree (s2k);
/* Release the copy of the (now unprotected) secret keys. */
if (pri_sk)