mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* free-packet.c (copy_secret_key): Fixed memory leak when D is not
NULL. * passphrase.c (passphrase_to_dek): Added a few comments to the code.
This commit is contained in:
parent
7e165d9758
commit
5c9cc2e867
3 changed files with 36 additions and 1 deletions
|
@ -265,10 +265,18 @@ 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[1])
|
||||
mpi_free (d->skey[1]);
|
||||
d->skey[i] = mpi_copy( s->skey[i] );
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue