The compiler emits a warning on free_zlib(), due to the "pool" variable that
can be used unitialized. We now initialize the variable and test its value to
remove this warning.
---
src/compression.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/compression.c b/src/compression.c
index e8a3fe1..45f5078 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -392,7 +392,7 @@ end:
static void free_zlib(void *opaque, void *ptr)
{
struct comp_ctx *ctx = opaque;
- struct pool_head *pool;
+ struct pool_head *pool = NULL;
if (ptr == ctx->zlib_window)
pool = zlib_pool_window;
@@ -405,9 +405,11 @@ static void free_zlib(void *opaque, void *ptr)
else if (ptr == ctx->zlib_pending_buf)
pool = zlib_pool_pending_buf;
- pool_free2(pool, ptr);
- if (global.maxzlibmem > 0)
- zlib_memory_available += pool->size;
+ if (pool != NULL) {
+ pool_free2(pool, ptr);
+ if (global.maxzlibmem > 0)
+ zlib_memory_available += pool->size;
+ }
}
--
1.7.10.4