libgourou/utils
Jean Schurger 82d0ef5484 Give libzip its own malloc() copy in zipWriteFile()
Since 97ad9ad, zipWriteFile() hands the ByteArray's buffer to libzip
with freep = 1. ByteArrays allocate with new[] by default (rights.xml,
encryption.xml and the inflated files all do), and libzip frees the
buffer with free() in zip_close(): valgrind reports "Mismatched free() /
delete / delete []" for each file written. takeShadowData() also leaves
an entry for the freed pointer in ByteArray::refCounter, so a later
ByteArray that gets the same address would never be freed.

Copy the content into a malloc() buffer owned by libzip instead: the
ByteArray keeps its own data, and the buffer is freed if
zip_source_buffer() fails. Checked under valgrind (add then replace,
ByteArray destroyed before zipClose()): 0 errors, nothing lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 14:10:40 +01:00
..
man Update man pages 2026-11-06 22:31:11 +01:00
acsmdownloader.cpp Pointers from dirname() must not be freed 2026-09-22 22:35:10 +02:00
adept_activate.cpp Fix bug in utils with -o and -O options 2026-02-01 08:56:27 +01:00
adept_loan_mgt.cpp Pointers from dirname() must not be freed 2026-09-22 22:35:10 +02:00
adept_remove.cpp Fix adept_remove -O placing result in a nested sub-directory 2026-07-01 11:14:30 +02:00
drmprocessorclientimpl.cpp Give libzip its own malloc() copy in zipWriteFile() 2026-11-09 14:10:40 +01:00
drmprocessorclientimpl.h Fix memory management errors (thanks to valgrind) 2026-09-18 21:56:00 +02:00
launcher.cpp Fix bug in utils with -o and -O options 2026-02-01 08:56:27 +01:00
LICENSE Initial commit 2021-07-03 21:57:53 +02:00
Makefile Honour CPPFLAGS, CXXFLAGS and LDFLAGS from the environment 2026-11-06 22:21:04 +01:00
utils_common.cpp Fix bug in utils with -o and -O options 2026-02-01 08:56:27 +01:00
utils_common.h Fix bug in utils with -o and -O options 2026-02-01 08:56:27 +01:00