summaryrefslogtreecommitdiffstats
path: root/sm/decrypt.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2021-04-12 14:05:17 +0200
committerWerner Koch <wk@gnupg.org>2021-05-20 13:51:47 +0200
commite6132bc9f41727ea1abe2d6298610223c11639a2 (patch)
tree6d76b81dc687c9dd7627e5495dd1cf815ad3be09 /sm/decrypt.c
parentg10: Fix memory leaks (diff)
downloadgnupg2-e6132bc9f41727ea1abe2d6298610223c11639a2.tar.xz
gnupg2-e6132bc9f41727ea1abe2d6298610223c11639a2.zip
sm: Avoid memory leaks and double double-free
* sm/certcheck.c (extract_pss_params): Avoid double free * sm/decrypt.c (gpgsm_decrypt): goto leave instead of return * sm/encrypt.c (encrypt_dek): release s_pkey * sm/server.c (cmd_export): free list (do_listkeys): free lists -- Signed-off-by: Jakub Jelen <jjelen@redhat.com> GnuPG-bug-id: 5393
Diffstat (limited to 'sm/decrypt.c')
-rw-r--r--sm/decrypt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sm/decrypt.c b/sm/decrypt.c
index d720913dc..c5f073190 100644
--- a/sm/decrypt.c
+++ b/sm/decrypt.c
@@ -1148,7 +1148,10 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp)
dfparm.mode = mode;
dfparm.blklen = gcry_cipher_get_algo_blklen (algo);
if (dfparm.blklen > sizeof (dfparm.helpblock))
- return gpg_error (GPG_ERR_BUG);
+ {
+ rc = gpg_error (GPG_ERR_BUG);
+ goto leave;
+ }
rc = ksba_cms_get_content_enc_iv (cms,
dfparm.iv,