You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Results:
$ valgrind --leak-check=full --show-leak-kinds=all ./test_zip
==19045== Memcheck, a memory error detector
==19045== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19045== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==19045== Command: ./test_zip
==19045==
==19045==
==19045== HEAP SUMMARY:
==19045== in use at exit: 403 bytes in 5 blocks
==19045== total heap usage: 5 allocs, 0 frees, 403 bytes allocated
==19045==
==19045== 11 bytes in 1 blocks are indirectly lost in loss record 1 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x52E8B49: strdup (strdup.c:42)
==19045== by 0x4164C2: _zip_source_file_or_p (zip_source_filep.c:150)
==19045== by 0x40F588: zip_source_file_create (zip_source_file.c:62)
==19045== by 0x407F2B: zip_open (zip_open.c:68)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 24 bytes in 1 blocks are indirectly lost in loss record 2 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x407211: _zip_hash_new (zip_hash.c:174)
==19045== by 0x414E73: _zip_new (zip_new.c:55)
==19045== by 0x409146: _zip_allocate_new (zip_open.c:526)
==19045== by 0x40818D: zip_open_from_source (zip_open.c:130)
==19045== by 0x407F76: zip_open (zip_open.c:74)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 80 bytes in 1 blocks are indirectly lost in loss record 3 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x40B74E: _zip_source_new (zip_source_function.c:83)
==19045== by 0x40B6B3: zip_source_function_create (zip_source_function.c:56)
==19045== by 0x4168AD: _zip_source_file_or_p (zip_source_filep.c:230)
==19045== by 0x40F588: zip_source_file_create (zip_source_file.c:62)
==19045== by 0x407F2B: zip_open (zip_open.c:68)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 160 bytes in 1 blocks are indirectly lost in loss record 4 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x416466: _zip_source_file_or_p (zip_source_filep.c:143)
==19045== by 0x40F588: zip_source_file_create (zip_source_file.c:62)
==19045== by 0x407F2B: zip_open (zip_open.c:68)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 403 (128 direct, 275 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x414E3C: _zip_new (zip_new.c:49)
==19045== by 0x409146: _zip_allocate_new (zip_open.c:526)
==19045== by 0x40818D: zip_open_from_source (zip_open.c:130)
==19045== by 0x407F76: zip_open (zip_open.c:74)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== LEAK SUMMARY:
==19045== definitely lost: 128 bytes in 1 blocks
==19045== indirectly lost: 275 bytes in 4 blocks
==19045== possibly lost: 0 bytes in 0 blocks
==19045== still reachable: 0 bytes in 0 blocks
==19045== suppressed: 0 bytes in 0 blocks
==19045==
==19045== For counts of detected and suppressed errors, rerun with: -v
==19045== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
If I'm doing anything wrong, please comment
The text was updated successfully, but these errors were encountered:
I noticed you're testing 1.4.0. 1.5.0 is out, please test that version.
Also, please check the return values of all functions. In particular, if zip_close() fails, it will not free the zip structure.
I used sources libzip-1.4.0
The test_zip.cpp sources:
#include "zip.h"
int main()
{
const char* path = "./test.zip";
int errorp = 0;
zip_t *zip = zip_open(path, ZIP_CREATE | ZIP_TRUNCATE, &errorp);
zip_close(zip);
}
Compilation:
gcc test_zip.cpp -L. -lzip -lz -lbz2 -o test_zip
Run:
$ valgrind --leak-check=full --show-leak-kinds=all ./test_zip
Results:
$ valgrind --leak-check=full --show-leak-kinds=all ./test_zip
==19045== Memcheck, a memory error detector
==19045== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19045== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==19045== Command: ./test_zip
==19045==
==19045==
==19045== HEAP SUMMARY:
==19045== in use at exit: 403 bytes in 5 blocks
==19045== total heap usage: 5 allocs, 0 frees, 403 bytes allocated
==19045==
==19045== 11 bytes in 1 blocks are indirectly lost in loss record 1 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x52E8B49: strdup (strdup.c:42)
==19045== by 0x4164C2: _zip_source_file_or_p (zip_source_filep.c:150)
==19045== by 0x40F588: zip_source_file_create (zip_source_file.c:62)
==19045== by 0x407F2B: zip_open (zip_open.c:68)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 24 bytes in 1 blocks are indirectly lost in loss record 2 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x407211: _zip_hash_new (zip_hash.c:174)
==19045== by 0x414E73: _zip_new (zip_new.c:55)
==19045== by 0x409146: _zip_allocate_new (zip_open.c:526)
==19045== by 0x40818D: zip_open_from_source (zip_open.c:130)
==19045== by 0x407F76: zip_open (zip_open.c:74)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 80 bytes in 1 blocks are indirectly lost in loss record 3 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x40B74E: _zip_source_new (zip_source_function.c:83)
==19045== by 0x40B6B3: zip_source_function_create (zip_source_function.c:56)
==19045== by 0x4168AD: _zip_source_file_or_p (zip_source_filep.c:230)
==19045== by 0x40F588: zip_source_file_create (zip_source_file.c:62)
==19045== by 0x407F2B: zip_open (zip_open.c:68)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 160 bytes in 1 blocks are indirectly lost in loss record 4 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x416466: _zip_source_file_or_p (zip_source_filep.c:143)
==19045== by 0x40F588: zip_source_file_create (zip_source_file.c:62)
==19045== by 0x407F2B: zip_open (zip_open.c:68)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== 403 (128 direct, 275 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 5
==19045== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19045== by 0x414E3C: _zip_new (zip_new.c:49)
==19045== by 0x409146: _zip_allocate_new (zip_open.c:526)
==19045== by 0x40818D: zip_open_from_source (zip_open.c:130)
==19045== by 0x407F76: zip_open (zip_open.c:74)
==19045== by 0x401558: main (in ./test_zip)
==19045==
==19045== LEAK SUMMARY:
==19045== definitely lost: 128 bytes in 1 blocks
==19045== indirectly lost: 275 bytes in 4 blocks
==19045== possibly lost: 0 bytes in 0 blocks
==19045== still reachable: 0 bytes in 0 blocks
==19045== suppressed: 0 bytes in 0 blocks
==19045==
==19045== For counts of detected and suppressed errors, rerun with: -v
==19045== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
If I'm doing anything wrong, please comment
The text was updated successfully, but these errors were encountered: