summaryrefslogtreecommitdiffstats
path: root/scd/app-p15.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2021-04-13 14:02:18 +0200
committerWerner Koch <wk@gnupg.org>2021-05-20 14:48:18 +0200
commit27e7bde12ee2b67425ae7011d976d2544c90fd9a (patch)
tree4d06aef22ddeddf773f7dc494bf45db7c2776bc4 /scd/app-p15.c
parentkbx: Avoid uninitialized read (diff)
downloadgnupg2-27e7bde12ee2b67425ae7011d976d2544c90fd9a.tar.xz
gnupg2-27e7bde12ee2b67425ae7011d976d2544c90fd9a.zip
scd: avoid memory leaks
* scd/app-p15.c (send_certinfo): free labelbuf (do_sign): goto leave instead of return * scd/app-piv.c (do_sign): goto leave instead of return, fix typo in variable name, avoid using uninitialized variables * scd/command.c (cmd_genkey): goto leave instead of return -- Signed-off-by: Jakub Jelen <jjelen@redhat.com> GnuPG-bug-id: 5393
Diffstat (limited to 'scd/app-p15.c')
-rw-r--r--scd/app-p15.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/scd/app-p15.c b/scd/app-p15.c
index 3aa8122f5..0530d377c 100644
--- a/scd/app-p15.c
+++ b/scd/app-p15.c
@@ -3851,6 +3851,7 @@ send_certinfo (app_t app, ctrl_t ctrl, const char *certtype,
labelbuf, strlen (labelbuf),
NULL, (size_t)0);
xfree (buf);
+ xfree (labelbuf);
}
return 0;
}
@@ -5461,7 +5462,7 @@ do_sign (app_t app, ctrl_t ctrl, const char *keyidstr, int hashalgo,
if (err)
{
log_error ("p15: MSE failed: %s\n", gpg_strerror (err));
- return err;
+ goto leave;
}
/* Now that we have all the information available run the actual PIN
@@ -5500,7 +5501,7 @@ do_sign (app_t app, ctrl_t ctrl, const char *keyidstr, int hashalgo,
if (err)
{
log_error ("p15: MSE failed: %s\n", gpg_strerror (err));
- return err;
+ goto leave;
}
if (prkdf->keyalgo == GCRY_PK_RSA && prkdf->keynbits > 2048)