aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2018-04-13 01:09:02 +0000
committerNIIBE Yutaka <[email protected]>2018-04-13 01:17:55 +0000
commit0f8fd95ab32a6d29dac79e19f0850037c7d0c16f (patch)
treeb9bca616c85ab4e96249f7e72599f0318748a1b0
parentpo: Fix a fr string. Mark a string fuzzy in ro and sk. (diff)
downloadgnupg-0f8fd95ab32a6d29dac79e19f0850037c7d0c16f.tar.gz
gnupg-0f8fd95ab32a6d29dac79e19f0850037c7d0c16f.zip
g10: Push compress filter only if compressed.
* g10/compress.c (handle_compressed): Fix memory leak. -- (backport from STABLE-BRANCH-2-2 commit: c31abf84659dbda5503dd9f3aa3449520bcd1b84) All other calls of push_compress_filter checks ALGO, so, do it here, too. GnuPG-bug-id: 3898 Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--g10/compress.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/g10/compress.c b/g10/compress.c
index 4598affff..aad8a751c 100644
--- a/g10/compress.c
+++ b/g10/compress.c
@@ -313,15 +313,18 @@ int
handle_compressed( void *procctx, PKT_compressed *cd,
int (*callback)(IOBUF, void *), void *passthru )
{
- compress_filter_context_t *cfx;
int rc;
if(check_compress_algo(cd->algorithm))
return G10ERR_COMPR_ALGO;
- cfx = xmalloc_clear (sizeof *cfx);
- cfx->release = release_context;
- cfx->algo = cd->algorithm;
- push_compress_filter(cd->buf,cfx,cd->algorithm);
+ if(cd->algorithm) {
+ compress_filter_context_t *cfx;
+
+ cfx = xmalloc_clear (sizeof *cfx);
+ cfx->release = release_context;
+ cfx->algo = cd->algorithm;
+ push_compress_filter(cd->buf,cfx,cd->algorithm);
+ }
if( callback )
rc = callback(cd->buf, passthru );
else