[Zlib-devel] [PATCH] One remaining Valgrind error

Daniel Richard G. oss at teragram.com
Thu Aug 16 14:23:33 EDT 2012


On Thu, 16 Aug 2012, Mark Adler wrote:

> On Aug 16, 2012, at 9:29 AM, Daniel Richard G. wrote:
>
> Umm, so how does a patch to deflate fix a valgrind complaint about 
> inflate?

That kind of error was only the motivator to get zlib Valgrind-clean. (I 
apologize for the misdirection; that wasn't very helpful.) As Jan noted, 
the version of zlib in that trace is an older one, from Ubuntu/oneiric 
Linux; if I link against what's in git:develop, the runtest trace comes 
out clean. If there were no other issue, this thread wouldn't exist.

Running Valgrind on the "example" program in git:develop, however, turns 
up this:

==7349== All heap blocks were freed -- no leaks are possible
==7349== 
==7349== ERROR SUMMARY: 27189 errors from 2 contexts (suppressed: 4 from 4)
==7349== 
==7349== 1 errors in context 1 of 2:
==7349== Conditional jump or move depends on uninitialised value(s)
==7349==    at 0x4114F3: gzputc (gzwrite.c:276)
==7349==    by 0x400D85: test_gzio (example.c:132)
==7349==    by 0x4022CD: main (example.c:580)
==7349==  Uninitialised value was created by a heap allocation
==7349==    at 0x4C28F9F: malloc (vg_replace_malloc.c:236)
==7349==    by 0x40F025: gz_open (gzlib.c:111)
==7349==    by 0x40F3E3: gzopen64 (gzlib.c:280)
==7349==    by 0x400D3B: test_gzio (example.c:127)
==7349==    by 0x4022CD: main (example.c:580)
==7349== 
==7349== 27188 errors in context 2 of 2:
==7349== Conditional jump or move depends on uninitialised value(s)
==7349==    at 0x40512C: fill_window (deflate.c:1442)
==7349==    by 0x40612F: deflate_slow (deflate.c:1743)
==7349==    by 0x404185: deflate (deflate.c:901)
==7349==    by 0x401733: test_large_deflate (example.c:319)
==7349==    by 0x402310: main (example.c:587)
==7349==  Uninitialised value was created by a heap allocation
==7349==    at 0x4C28F9F: malloc (vg_replace_malloc.c:236)
==7349==    by 0x40EC4B: zcalloc (zutil.c:310)
==7349==    by 0x402662: deflateInit2_ (deflate.c:294)
==7349==    by 0x4023F1: deflateInit_ (deflate.c:207)
==7349==    by 0x4015A7: test_large_deflate (example.c:290)
==7349==    by 0x402310: main (example.c:587)

("example64" gives an identical trace, but for "gzopen" being replaced by 
"gzopen64". The other test programs come up clean.)

The first error listed above is unique to the develop branch; it doesn't 
occur with git:master code.


--Daniel


-- 
Daniel Richard G. || danielg at teragram.com || Software Developer
Teragram Linguistic Technologies (a division of SAS)
http://www.teragram.com/





More information about the Zlib-devel mailing list