1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

common: Fix memory leaks.

* common/name-value.c (do_nvc_parse): Free NAME.
* common/recsel.c (recsel_parse_expr): Release SE_HEAD and EXPR_BUFFER.

--

GnuPG-bug-id: 5393
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Jakub Jelen 2021-04-13 14:54:53 +09:00 committed by NIIBE Yutaka
parent 51bbd99a3c
commit a16f726f94
2 changed files with 12 additions and 2 deletions

View File

@ -777,9 +777,13 @@ do_nvc_parse (nvc_t *result, int *errlinep, estream_t stream,
/* Add the final entry. */
if (raw_value)
err = _nvc_add (*result, name, NULL, raw_value, 1);
{
err = _nvc_add (*result, name, NULL, raw_value, 1);
name = NULL;
}
leave:
xfree (name);
gpgrt_free (buf);
if (err)
{

View File

@ -249,7 +249,13 @@ recsel_parse_expr (recsel_expr_t *selector, const char *expression)
se = xtrymalloc (sizeof *se + strlen (expr));
if (!se)
return my_error_from_syserror ();
{
gpg_error_t err = my_error_from_syserror ();
recsel_release (se_head);
xfree (expr_buffer);
return err;
}
strcpy (se->name, expr);
se->next = NULL;
se->not = 0;