summaryrefslogtreecommitdiffstats
path: root/g10/import.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-04-17 02:58:07 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2019-04-17 02:58:07 +0200
commita861f9343d6e6d18064e4e54aeb914c5a10b2095 (patch)
tree81fda731848897e4d91c23ab17c777488c912aba /g10/import.c
parentcommon: Fix AWK portability. (diff)
downloadgnupg2-a861f9343d6e6d18064e4e54aeb914c5a10b2095.tar.xz
gnupg2-a861f9343d6e6d18064e4e54aeb914c5a10b2095.zip
g10: Fix a memory leak.
* g10/import.c (import): Care PNDING_PKT on error. -- GnuPG-bug-id: 4461 Reported-by: Philippe Antoine Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r--g10/import.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c
index 565086773..00bc47cc1 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -689,6 +689,13 @@ import (ctrl_t ctrl, IOBUF inp, const char* fname,struct import_stats_s *stats,
log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (rc));
release_kbnode (secattic);
+
+ /* When read_block loop was stopped by error, we have PENDING_PKT left. */
+ if (pending_pkt)
+ {
+ free_packet (pending_pkt, NULL);
+ xfree (pending_pkt);
+ }
return rc;
}