aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <[email protected]>2014-12-19 23:07:55 +0000
committerNIIBE Yutaka <[email protected]>2015-01-13 01:52:22 +0000
commit0fd4cd8503dfe9c3e6a362003bd647b4cd882363 (patch)
treee1356dc0cabbaa0d98c25c71d6531fd57d087463
parentavoid future chance of using uninitialized memory (diff)
downloadgnupg-0fd4cd8503dfe9c3e6a362003bd647b4cd882363.tar.gz
gnupg-0fd4cd8503dfe9c3e6a362003bd647b4cd882363.zip
scd: Avoid double-free on error condition in scd
* scd/command.c (cmd_readkey): avoid double-free of cert -- When ksba_cert_new() fails, cert will be double-freed. Debian-Bug-Id: 773471 Original patch changed by wk to do the free only at leave.
-rw-r--r--scd/command.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/scd/command.c b/scd/command.c
index fc1f5a20e..b26bd6862 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -777,10 +777,8 @@ cmd_readkey (assuan_context_t ctx, char *line)
rc = ksba_cert_new (&kc);
if (rc)
- {
- xfree (cert);
- goto leave;
- }
+ goto leave;
+
rc = ksba_cert_init_from_mem (kc, cert, ncert);
if (rc)
{