mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
(copy_secret_key): Get last fix right.
This commit is contained in:
parent
5024c31036
commit
c604d59716
@ -1,3 +1,7 @@
|
|||||||
|
2004-06-16 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* free-packet.c (copy_secret_key): Get last fix right.
|
||||||
|
|
||||||
2004-06-16 Werner Koch <wk@gnupg.org>
|
2004-06-16 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* free-packet.c (copy_secret_key): Fixed memory leak.
|
* free-packet.c (copy_secret_key): Fixed memory leak.
|
||||||
|
@ -261,21 +261,15 @@ copy_secret_key( PKT_secret_key *d, PKT_secret_key *s )
|
|||||||
|
|
||||||
if( !d )
|
if( !d )
|
||||||
d = m_alloc(sizeof *d);
|
d = m_alloc(sizeof *d);
|
||||||
|
else
|
||||||
|
release_secret_key_parts (d);
|
||||||
memcpy( d, s, sizeof *d );
|
memcpy( d, s, sizeof *d );
|
||||||
n = pubkey_get_nskey( s->pubkey_algo );
|
n = pubkey_get_nskey( s->pubkey_algo );
|
||||||
if( !n )
|
if( !n )
|
||||||
{
|
d->skey[0] = mpi_copy(s->skey[0]);
|
||||||
if (d->skey[0])
|
|
||||||
mpi_free (d->skey[0]);
|
|
||||||
d->skey[0] = mpi_copy(s->skey[0]);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
for(i=0; i < n; i++ )
|
for(i=0; i < n; i++ )
|
||||||
{
|
d->skey[i] = mpi_copy( s->skey[i] );
|
||||||
if (d->skey[i])
|
|
||||||
mpi_free (d->skey[i]);
|
|
||||||
d->skey[i] = mpi_copy( s->skey[i] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user