aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2014-09-26 19:43:47 -0700
committerAndreas Schneider <asn@cryptomilk.org>2014-10-02 08:25:27 +0200
commit8b3425865a6952024f533af201feb23ad816aee0 (patch)
treea4e02bd193b695b4a5af9d35a4793697d0aacab1
parenta30e234c03ff776ff58c1f9d94a83901b8d17f8d (diff)
downloadlibssh-8b3425865a6952024f533af201feb23ad816aee0.tar.gz
libssh-8b3425865a6952024f533af201feb23ad816aee0.tar.xz
libssh-8b3425865a6952024f533af201feb23ad816aee0.zip
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@jonsimons.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> (cherry picked from commit 092fe0b727399cd971709c16c030bc093ca54d87)
-rw-r--r--src/wrapper.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wrapper.c b/src/wrapper.c
index 94175d0e..b5aaa78a 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -130,10 +130,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);