From c4dc68d8a2ebf9723b1cd83c5db6196b3eb58396 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Sun, 20 Apr 2008 16:25:43 +0000 Subject: Fix a possible memleak in inflateMemory if the stream fails to uncompress cleanly. --- ChangeLog | 4 ++++ src/utils/zlib.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index c5fd59d2..c010be3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-20 Dennis Friis + * src/utils/zlib.cpp: Fix a possible memleak in inflateMemory if the + stream fails to uncompress cleanly. + 2008-04-19 Yohann Ferreira * src/account-server/accounthandler.cpp, diff --git a/src/utils/zlib.cpp b/src/utils/zlib.cpp index a29b0c86..2bd2f237 100644 --- a/src/utils/zlib.cpp +++ b/src/utils/zlib.cpp @@ -68,6 +68,7 @@ bool inflateMemory(char *in, unsigned inLength, if (ret != Z_OK) { logZlibError(ret); + free(out); return false; } @@ -83,6 +84,7 @@ bool inflateMemory(char *in, unsigned inLength, case Z_MEM_ERROR: inflateEnd(&strm); logZlibError(ret); + free(out); return false; } @@ -94,6 +96,7 @@ bool inflateMemory(char *in, unsigned inLength, { inflateEnd(&strm); logZlibError(Z_MEM_ERROR); + free(out); return false; } @@ -107,6 +110,7 @@ bool inflateMemory(char *in, unsigned inLength, if (strm.avail_in != 0) { logZlibError(Z_DATA_ERROR); + free(out); return false; } -- cgit v1.2.3-70-g09d2