1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-17 00:39:50 +02:00

(copy_secret_key): Fixed memory leak.

This commit is contained in:
Werner Koch 2004-06-16 09:36:59 +00:00
parent 20917c3c30
commit 40e66b1af1
3 changed files with 14 additions and 0 deletions

1
THANKS
View File

@ -11,6 +11,7 @@ Anand Kumria wildfire@progsoc.uts.edu.au
Andreas Haumer andreas@xss.co.at
Anthony Mulcahy anthony@kcn.ne.jp
Ariel T Glenn ariel@columbia.edu
Atom 'Smasher' atom@suspicious.org
Bob Mathews bobmathews@mindspring.com
Bodo Moeller Bodo_Moeller@public.uni-hamburg.de
Brendan O'Dea bod@debian.org

View File

@ -1,3 +1,7 @@
2004-06-16 Werner Koch <wk@gnupg.org>
* free-packet.c (copy_secret_key): Fixed memory leak.
2004-06-01 David Shaw <dshaw@jabberwocky.com>
* g10.c (main): Alias --charset as --display-charset to help avoid

View File

@ -264,11 +264,20 @@ copy_secret_key( PKT_secret_key *d, PKT_secret_key *s )
memcpy( d, s, sizeof *d );
n = pubkey_get_nskey( s->pubkey_algo );
if( !n )
{
if (d->skey[0])
mpi_free (d->skey[0]);
d->skey[0] = mpi_copy(s->skey[0]);
}
else {
for(i=0; i < n; i++ )
{
if (d->skey[i])
mpi_free (d->skey[i]);
d->skey[i] = mpi_copy( s->skey[i] );
}
}
return d;
}