ia64/xen-unstable

changeset 18902:b73f3646a17f

libxc: Fix memory leak in zlib usage

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

Signed-off-by: Kevin Wolf <kwolf@suse.de>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 10 13:14:13 2008 +0000 (2008-12-10)
parents 6595393a3d28
children 9ba1541d6dc2
files tools/libxc/xc_dom_core.c tools/libxc/xg_private.c
line diff
     1.1 --- a/tools/libxc/xc_dom_core.c	Tue Dec 09 16:28:02 2008 +0000
     1.2 +++ b/tools/libxc/xc_dom_core.c	Wed Dec 10 13:14:13 2008 +0000
     1.3 @@ -244,6 +244,7 @@ int xc_dom_do_gunzip(void *src, size_t s
     1.4          return -1;
     1.5      }
     1.6      rc = inflate(&zStream, Z_FINISH);
     1.7 +    inflateEnd(&zStream);
     1.8      if ( rc != Z_STREAM_END )
     1.9      {
    1.10          xc_dom_panic(XC_INTERNAL_ERROR,
     2.1 --- a/tools/libxc/xg_private.c	Tue Dec 09 16:28:02 2008 +0000
     2.2 +++ b/tools/libxc/xg_private.c	Wed Dec 10 13:14:13 2008 +0000
     2.3 @@ -131,6 +131,7 @@ char *xc_inflate_buffer(const char *in_b
     2.4  
     2.5      /* Inflate in one pass/call */
     2.6      sts = inflate(&zStream, Z_FINISH);
     2.7 +    inflateEnd(&zStream);
     2.8      if ( sts != Z_STREAM_END )
     2.9      {
    2.10          ERROR("inflate failed, sts %d\n", sts);