Skip to contentSkip to conversation

libxc: Fix memory leak in zlib usage

PATCH New Kevin Wolf 1 participant 1 message Dec 9, 2008

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 libxc: Fix memory leak in zlib usage

Any call to inflate() must be followed by inflateEnd(), otherwise the internal zlib state is leaked.

tools/libxc/xc_dom_core.c +1 -0
Index: xen-unstable.hg/tools/libxc/xc_dom_core.c
===================================================================
@@ -244,6 +244,7 @@ int xc_dom_do_gunzip(void *src, size_t s
         return -1;
     }
     rc = inflate(&zStream, Z_FINISH);
+    inflateEnd(&zStream);
     if ( rc != Z_STREAM_END )
     {
         xc_dom_panic(XC_INTERNAL_ERROR,
tools/libxc/xg_private.c +1 -0
Index: xen-unstable.hg/tools/libxc/xg_private.c
===================================================================
@@ -131,6 +131,7 @@ char *xc_inflate_buffer(const char *in_b
 
     /* Inflate in one pass/call */
     sts = inflate(&zStream, Z_FINISH);
+    inflateEnd(&zStream);
     if ( sts != Z_STREAM_END )
     {
         ERROR("inflate failed, sts %d\n", sts);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel