Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are memory leaks in zziplib v0.13.68 which is trigged in zzip_mem_disk_new(in zzip/memdisk.c:78) #40

Closed
fantasy7082 opened this Issue Mar 6, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@fantasy7082
Copy link

fantasy7082 commented Mar 6, 2018

There are some memory leaks in zziplib which is trigged in function zzip_mem_disk_new(in zzip/memdisk.c:78).

Steps to Reproduce:

./unzzip-mem 002-mem-leaks 

=================================================================
==53743==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff6f0279a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7ffff6c65261 in zzip_mem_disk_new ../../zzip/memdisk.c:78

Indirect leak of 3808 byte(s) in 28 object(s) allocated from:
    #0 0x7ffff6f0279a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x7ffff6c65866 in zzip_mem_entry_new ../../zzip/memdisk.c:197

Indirect leak of 657 byte(s) in 28 object(s) allocated from:
    #0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x7ffff69214d9 in strndup (/lib/x86_64-linux-gnu/libc.so.6+0x8b4d9)

Indirect leak of 255 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x7ffff6c660cb in zzip_mem_entry_new ../../zzip/memdisk.c:251

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x7ffff6c6252f in zzip_disk_new ../../zzip/mmapped.c:89
    #2 0x7ffff6c67c7f  (/usr/local/zzip-asan/lib/libzzipmmapped-0.so.13+0x7c7f)

Indirect leak of 28 byte(s) in 28 object(s) allocated from:
    #0 0x7ffff6ecc30f in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x6230f)
    #1 0x7ffff6c632d1 in zzip_disk_entry_strdup_comment ../../zzip/mmapped.c:351

SUMMARY: AddressSanitizer: 4836 byte(s) leaked in 87 allocation(s)

POC FILE:https://github.com/fantasy7082/image_test/blob/master/002-mem-leaks-zip

gdraheim added a commit that referenced this issue Mar 13, 2018

gdraheim added a commit that referenced this issue Mar 13, 2018

@gdraheim

This comment has been minimized.

Copy link
Owner

gdraheim commented Mar 13, 2018

I have added an option --with-asan to compile with asan-support, but there is not output from that one.

=> don't know how to reproduce

@gdraheim

This comment has been minimized.

Copy link
Owner

gdraheim commented Mar 14, 2018

After checking the source code it became apparent that some disk_open() was not partnered with some disk_close() in the bins/*-mem.c parts.

fixed.

@gdraheim gdraheim added this to the v0.13.69 release milestone Mar 14, 2018

@gdraheim

This comment has been minimized.

Copy link
Owner

gdraheim commented Mar 15, 2018

done.

@gdraheim gdraheim closed this Mar 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.