Tiny memory leak in do_check()?
Stefanus Du Toit
sjdutoit at uwaterloo.ca
Mon Oct 30 23:52:10 CET 2000
Hi,
There seems to be a _tiny_ memory leek in seckey-cert.c:do_check().
Basically, release_secret_key_parts() needs to be called before
copying the copy of sk back into sk since the sk->skey entries get
replaced with newly allocated entries and the previously allocated
entries get lost.
here's a patch, you'll want to verify whether this is The Right Way.
Thanks for an excellent program, keep up the good work! Ich bin
wahrhaftig beeindruckt! :)
--
Stefanus Du Toit
sjdutoit at uwaterloo dot ca http://3.141593.org/
Please use GnuPG/PGP: http://3.141593.org/gpg/
-------------- next part --------------
--- gnupg-1.0.4-vanilla/g10/seckey-cert.c Wed Sep 13 12:12:19 2000
+++ gnupg-1.0.4/g10/seckey-cert.c Mon Oct 30 23:35:23 2000
@@ -137,6 +137,7 @@
cipher_close( cipher_hd );
/* now let's see whether we have used the right passphrase */
if( csum != sk->csum ) {
+ release_secret_key_parts( sk );
copy_secret_key( sk, save_sk );
free_secret_key( save_sk );
return G10ERR_BAD_PASS;
@@ -144,6 +145,7 @@
/* the checksum may fail, so we also check the key itself */
res = pubkey_check_secret_key( sk->pubkey_algo, sk->skey );
if( res ) {
+ release_secret_key_parts( sk );
copy_secret_key( sk, save_sk );
free_secret_key( save_sk );
return G10ERR_BAD_PASS;
More information about the Gnupg-devel
mailing list