aboutsummaryrefslogtreecommitdiffstats
path: root/scd
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2024-11-11 04:49:06 +0000
committerNIIBE Yutaka <[email protected]>2024-11-11 04:49:06 +0000
commit2f6b479919f98daf11cdea0b71e2e1ea5c4792dc (patch)
treedcd73b4daeec0c92272df64d3c988dbd48590cb8 /scd
parentscd: Fix resource leaks on error paths. (diff)
downloadgnupg-2f6b479919f98daf11cdea0b71e2e1ea5c4792dc.tar.gz
gnupg-2f6b479919f98daf11cdea0b71e2e1ea5c4792dc.zip
scd: Fix a memory leak.
* scd/app-help.c (app_help_read_length_of_cert): Free the BUFFER. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd')
-rw-r--r--scd/app-help.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/scd/app-help.c b/scd/app-help.c
index a542a53f2..e611ce3ae 100644
--- a/scd/app-help.c
+++ b/scd/app-help.c
@@ -250,6 +250,7 @@ app_help_read_length_of_cert (int slot, int fid, size_t *r_certoff)
&& (tag == TAG_SEQUENCE || tag == TAG_SET)))
{
log_info ("data at FID 0x%04X does not look like a certificate\n", fid);
+ xfree (buffer);
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,
&ndef, &objlen, &hdrlen);
+ xfree (buffer);
if (err)
return 0;
@@ -279,6 +281,8 @@ app_help_read_length_of_cert (int slot, int fid, size_t *r_certoff)
else
*r_certoff = 0;
}
+ else
+ xfree (buffer);
return resultlen;
}