aboutsummaryrefslogtreecommitdiffstats
path: root/g10/import.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-05-02 17:44:10 +0000
committerWerner Koch <[email protected]>2018-05-02 18:15:10 +0000
commitd26363e4f1933781c86cbe87077fbf1b9a2b64d8 (patch)
tree11201abe599f50b55ce6abee5c95f5442a1acd31 /g10/import.c
parentgpg: Fix "Too many open files" when using --multifile. (diff)
downloadgnupg-d26363e4f1933781c86cbe87077fbf1b9a2b64d8.tar.gz
gnupg-d26363e4f1933781c86cbe87077fbf1b9a2b64d8.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--g10/import.c6
1 files changed, 4 insertions, 2 deletions
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);