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

scd: Fix a memory leak.

* scd/app-help.c (app_help_read_length_of_cert): Free the BUFFER.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2024-11-11 13:49:06 +09:00
parent b1f2695d24
commit 2f6b479919
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -250,6 +250,7 @@ app_help_read_length_of_cert (int slot, int fid, size_t *r_certoff)
&& (tag == TAG_SEQUENCE || tag == TAG_SET))) && (tag == TAG_SEQUENCE || tag == TAG_SET)))
{ {
log_info ("data at FID 0x%04X does not look like a certificate\n", fid); log_info ("data at FID 0x%04X does not look like a certificate\n", fid);
xfree (buffer);
return 0; return 0;
} }
@ -261,6 +262,7 @@ app_help_read_length_of_cert (int slot, int fid, size_t *r_certoff)
err = parse_ber_header (&p, &n, &class, &tag, &constructed, err = parse_ber_header (&p, &n, &class, &tag, &constructed,
&ndef, &objlen, &hdrlen); &ndef, &objlen, &hdrlen);
xfree (buffer);
if (err) if (err)
return 0; return 0;
@ -279,6 +281,8 @@ app_help_read_length_of_cert (int slot, int fid, size_t *r_certoff)
else else
*r_certoff = 0; *r_certoff = 0;
} }
else
xfree (buffer);
return resultlen; return resultlen;
} }