if inflate() fails, free the stream instead of leaking it
[ctfdump/.git] / ctfdump.c
index 52dbbab607b45fe18ac78523145c2c81a865d256..02a5fce443fa8883deb27773eabfa206df9c842a 100644 (file)
--- a/ctfdump.c
+++ b/ctfdump.c
@@ -566,6 +566,7 @@ decompress(const char *buf, size_t size, off_t len)
 
        if ((error = inflate(&stream, Z_FINISH)) != Z_STREAM_END) {
                warnx("zlib inflate failed: %s", zError(error));
+               inflateEnd(&stream);
                goto exit;
        }