mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
cwebp: cleanup after memory_writer
always initialize the memory_writer so it can be unconditionally freed on exit Change-Id: I9226addb588309446ec94abadfdde201f23195d2
This commit is contained in:
parent
12d6cecfbd
commit
88d382a042
@ -632,6 +632,7 @@ int main(int argc, const char *argv[]) {
|
||||
Stopwatch stop_watch;
|
||||
|
||||
MetadataInit(&metadata);
|
||||
WebPMemoryWriterInit(&memory_writer);
|
||||
if (!WebPPictureInit(&picture) ||
|
||||
!WebPPictureInit(&original_picture) ||
|
||||
!WebPConfigInit(&config)) {
|
||||
@ -897,7 +898,6 @@ int main(int argc, const char *argv[]) {
|
||||
picture.writer = MyWriter;
|
||||
picture.custom_ptr = (void*)out;
|
||||
} else {
|
||||
WebPMemoryWriterInit(&memory_writer);
|
||||
picture.writer = WebPMemoryWrite;
|
||||
picture.custom_ptr = (void*)&memory_writer;
|
||||
}
|
||||
@ -983,6 +983,7 @@ int main(int argc, const char *argv[]) {
|
||||
return_value = 0;
|
||||
|
||||
Error:
|
||||
free(memory_writer.mem);
|
||||
free(picture.extra_info);
|
||||
MetadataFree(&metadata);
|
||||
WebPPictureFree(&picture);
|
||||
|
Loading…
Reference in New Issue
Block a user