From d26363e4f1933781c86cbe87077fbf1b9a2b64d8 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 2 May 2018 19:44:10 +0200 Subject: gpg: Fix minor memory leak in the compress filter. * g10/compress.c (push_compress_filter2): Return an error if no filter was pushed. (push_compress_filter): Ditto. (handle_compressed): Free CFX if no filter was pushed. * g10/import.c (read_block): Ditto. -- GnuPG-bug-id: 3898, 3930 Signed-off-by: Werner Koch --- g10/import.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'g10/import.c') diff --git a/g10/import.c b/g10/import.c index 71e39557c..c07f67fe2 100644 --- a/g10/import.c +++ b/g10/import.c @@ -767,7 +767,7 @@ valid_keyblock_packet (int pkttype) * Meta data (ring trust packets) are only considered of WITH_META is set. * PENDING_PKT should be initialized to NULL and not changed by the caller. * Return: 0 = okay, -1 no more blocks or another errorcode. - * The int at at R_V3KEY counts the number of unsupported v3 + * The int at R_V3KEY counts the number of unsupported v3 * keyblocks. */ static int @@ -856,7 +856,9 @@ read_block( IOBUF a, int with_meta, { compress_filter_context_t *cfx = xmalloc_clear( sizeof *cfx ); pkt->pkt.compressed->buf = NULL; - push_compress_filter2(a,cfx,pkt->pkt.compressed->algorithm,1); + if (push_compress_filter2 (a, cfx, + pkt->pkt.compressed->algorithm, 1)) + xfree (cfx); /* e.g. in case of compression_algo NONE. */ } free_packet (pkt, &parsectx); init_packet(pkt); -- cgit v1.2.3