mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-16 22:09:57 +02:00
mux{edit,internal}: fix leaks on error
several calls to ChunkSetHead() were unchecked, causing the chunk to leak should the call fail due to OOM Tested: for i in `seq 1 1125`; do export MALLOC_FAIL_AT=$i ./examples/gif2webp gif_file ./examples/gif2webp -mixed gif_file done for i in `seq 1 171`; do export MALLOC_FAIL_AT=$i ./examples/img2webp jpeg_file -o /dev/null ./examples/img2webp -mixed jpeg_file -o /dev/null done Change-Id: I479bc487f61b493e5ce033872d353007055c172a
This commit is contained in:
@ -70,6 +70,7 @@ void WebPMuxDelete(WebPMux* mux) {
|
||||
err = ChunkAssignData(&chunk, data, copy_data, tag); \
|
||||
if (err == WEBP_MUX_OK) { \
|
||||
err = ChunkSetHead(&chunk, (LIST)); \
|
||||
if (err != WEBP_MUX_OK) ChunkRelease(&chunk); \
|
||||
} \
|
||||
return err; \
|
||||
}
|
||||
|
Reference in New Issue
Block a user