mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
g10: Fix secmem leak.
* g10/keygen.c (proc_parameter_file): Fix secmem leak. -- proc_parameter_file() adds certain parameters to the list in the para argument; however, these new entries are leaked because they are added to head, while the para list is released by the caller of proc_parameter_file. GnuPG-bug-id: 1371
This commit is contained in:
parent
bb61191aad
commit
de441cb9cc
24
g10/keygen.c
24
g10/keygen.c
@ -2329,8 +2329,8 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
|||||||
r = xmalloc_clear(sizeof(*r));
|
r = xmalloc_clear(sizeof(*r));
|
||||||
r->key = pKEYUSAGE;
|
r->key = pKEYUSAGE;
|
||||||
r->u.usage = openpgp_pk_algo_usage(algo);
|
r->u.usage = openpgp_pk_algo_usage(algo);
|
||||||
r->next = para;
|
r->next = para->next;
|
||||||
para = r;
|
para->next = r;
|
||||||
}
|
}
|
||||||
else if (err == -1)
|
else if (err == -1)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2363,8 +2363,8 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
|||||||
r = xmalloc_clear (sizeof(*r));
|
r = xmalloc_clear (sizeof(*r));
|
||||||
r->key = pSUBKEYUSAGE;
|
r->key = pSUBKEYUSAGE;
|
||||||
r->u.usage = openpgp_pk_algo_usage (algo);
|
r->u.usage = openpgp_pk_algo_usage (algo);
|
||||||
r->next = para;
|
r->next = para->next;
|
||||||
para = r;
|
para->next = r;
|
||||||
}
|
}
|
||||||
else if (err == -1)
|
else if (err == -1)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2400,8 +2400,8 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
|||||||
p = stpcpy(stpcpy(stpcpy(p," ("), s2 ),")");
|
p = stpcpy(stpcpy(stpcpy(p," ("), s2 ),")");
|
||||||
if( s3 )
|
if( s3 )
|
||||||
p = stpcpy(stpcpy(stpcpy(p," <"), s3 ),">");
|
p = stpcpy(stpcpy(stpcpy(p," <"), s3 ),">");
|
||||||
r->next = para;
|
r->next = para->next;
|
||||||
para = r;
|
para->next = r;
|
||||||
have_user_id=1;
|
have_user_id=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2460,13 +2460,13 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
|||||||
r = xmalloc_clear( sizeof *r );
|
r = xmalloc_clear( sizeof *r );
|
||||||
r->key = pPASSPHRASE_S2K;
|
r->key = pPASSPHRASE_S2K;
|
||||||
r->u.s2k = s2k;
|
r->u.s2k = s2k;
|
||||||
r->next = para;
|
r->next = para->next;
|
||||||
para = r;
|
para->next = r;
|
||||||
r = xmalloc_clear( sizeof *r );
|
r = xmalloc_clear( sizeof *r );
|
||||||
r->key = pPASSPHRASE_DEK;
|
r->key = pPASSPHRASE_DEK;
|
||||||
r->u.dek = dek;
|
r->u.dek = dek;
|
||||||
r->next = para;
|
r->next = para->next;
|
||||||
para = r;
|
para->next = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make KEYCREATIONDATE from Creation-Date. */
|
/* Make KEYCREATIONDATE from Creation-Date. */
|
||||||
@ -2504,8 +2504,8 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
|||||||
r = xmalloc_clear( sizeof *r + 20 );
|
r = xmalloc_clear( sizeof *r + 20 );
|
||||||
r->key = pSUBKEYEXPIRE;
|
r->key = pSUBKEYEXPIRE;
|
||||||
r->u.expire = seconds;
|
r->u.expire = seconds;
|
||||||
r->next = para;
|
r->next = para->next;
|
||||||
para = r;
|
para->next = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !!outctrl->pub.newfname ^ !!outctrl->sec.newfname ) {
|
if( !!outctrl->pub.newfname ^ !!outctrl->sec.newfname ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user