[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] wrapper: fix z_stream leak


Attached is a leak fix for the 'z_stream' structures used with
buffer compression/decompression.


-Jon
From cf1d25bcf0b34805a8c7b12e8949684e53d8a5fa Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Fri, 26 Sep 2014 19:43:47 -0700
Subject: [PATCH] wrapper: fix z_stream leak

Ensure to free the z_stream structures as allocated from
the gzip.c initcompress, initdecompress functions.

Signed-off-by: Jon Simons <jon@xxxxxxxxxxxxx>
---
 src/wrapper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/wrapper.c b/src/wrapper.c
index f2f0b6a..bcd941b 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -170,10 +170,13 @@ void crypto_free(struct ssh_crypto_struct *crypto){
       (deflateEnd(crypto->compress_out_ctx) != 0)) {
     inflateEnd(crypto->compress_out_ctx);
   }
+  SAFE_FREE(crypto->compress_out_ctx);
+
   if (crypto->compress_in_ctx &&
       (deflateEnd(crypto->compress_in_ctx) != 0)) {
     inflateEnd(crypto->compress_in_ctx);
   }
+  SAFE_FREE(crypto->compress_in_ctx);
 #endif /* WITH_ZLIB */
   if(crypto->encryptIV)
     SAFE_FREE(crypto->encryptIV);
-- 
2.1.1.602.g02f248d


Archive administrator: postmaster@lists.cynapses.org