All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxc: Fix memory leak in zlib usage
@ 2008-12-09 17:42 Kevin Wolf
  0 siblings, 0 replies; only message in thread
From: Kevin Wolf @ 2008-12-09 17:42 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

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

Signed-off-by: Kevin Wolf <kwolf@suse.de>

[-- Attachment #2: libxc-zlib-memleak.patch --]
[-- Type: text/x-patch, Size: 912 bytes --]

Index: xen-unstable.hg/tools/libxc/xc_dom_core.c
===================================================================
--- xen-unstable.hg.orig/tools/libxc/xc_dom_core.c
+++ 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,
Index: xen-unstable.hg/tools/libxc/xg_private.c
===================================================================
--- xen-unstable.hg.orig/tools/libxc/xg_private.c
+++ 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);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-09 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 17:42 [PATCH] libxc: Fix memory leak in zlib usage Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.