[git] GnuPG - branch, master, updated. gnupg-2.1.18-68-g5996c7b
by Werner Koch
cvs at cvs.gnupg.org
Fri Feb 10 18:05:53 CET 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, master has been updated
via 5996c7bf99f3a681393fd9589276399ebc956cff (commit)
from 8810314e377a9cb6612150a57cf99260ed0bb9f6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5996c7bf99f3a681393fd9589276399ebc956cff
Author: Werner Koch <wk at gnupg.org>
Date: Fri Feb 10 17:16:07 2017 +0100
gpg: Fix memory leak in the error case of signature creation.
* g10/sign.c (write_signature_packets): Free SIG. Also replace
xcalloc by xtrycalloc.
--
If do_sign fails SIG was not released. Note that in the good case SIG
is transferred to PKT and freed by free_packet.
Reported-by: Stephan Müller
Signed-off-by: Werner Koch <wk at gnupg.org>
diff --git a/g10/sign.c b/g10/sign.c
index acc894c..ff099b3 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -686,7 +686,10 @@ write_signature_packets (SK_LIST sk_list, IOBUF out, gcry_md_hd_t hash,
pk = sk_rover->pk;
/* Build the signature packet. */
- sig = xmalloc_clear (sizeof *sig);
+ sig = xtrycalloc (1, sizeof *sig);
+ if (!sig)
+ return gpg_error_from_syserror ();
+
if (duration || opt.sig_policy_url
|| opt.sig_notations || opt.sig_keyserver_url)
sig->version = 4;
@@ -731,8 +734,12 @@ write_signature_packets (SK_LIST sk_list, IOBUF out, gcry_md_hd_t hash,
print_status_sig_created (pk, sig, status_letter);
free_packet (&pkt);
if (rc)
- log_error ("build signature packet failed: %s\n", gpg_strerror (rc));
+ log_error ("build signature packet failed: %s\n",
+ gpg_strerror (rc));
}
+ else
+ xfree (sig);
+
if (rc)
return rc;
}
-----------------------------------------------------------------------
Summary of changes:
g10/sign.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list