aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorJakub Jelen <[email protected]>2021-04-13 12:02:18 +0000
committerWerner Koch <[email protected]>2021-05-20 12:48:18 +0000
commit27e7bde12ee2b67425ae7011d976d2544c90fd9a (patch)
tree4d06aef22ddeddf773f7dc494bf45db7c2776bc4 /scd/command.c
parentkbx: Avoid uninitialized read (diff)
downloadgnupg-27e7bde12ee2b67425ae7011d976d2544c90fd9a.tar.gz
gnupg-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 <[email protected]> GnuPG-bug-id: 5393
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/scd/command.c b/scd/command.c
index 11d61648b..cb0dd379a 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -1438,7 +1438,10 @@ cmd_genkey (assuan_context_t ctx, char *line)
line = skip_options (line);
if (!*line)
- return set_error (GPG_ERR_ASS_PARAMETER, "no key number given");
+ {
+ err = set_error (GPG_ERR_ASS_PARAMETER, "no key number given");
+ goto leave;
+ }
keyref = line;
while (*line && !spacep (line))
line++;
@@ -1448,7 +1451,10 @@ cmd_genkey (assuan_context_t ctx, char *line)
goto leave;
if (!ctrl->card_ctx)
- return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
+ {
+ err = gpg_error (GPG_ERR_UNSUPPORTED_OPERATION);
+ goto leave;
+ }
keyref = keyref_buffer = xtrystrdup (keyref);
if (!keyref)