mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-06 00:46:50 +02: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;
|
Stopwatch stop_watch;
|
||||||
|
|
||||||
MetadataInit(&metadata);
|
MetadataInit(&metadata);
|
||||||
|
WebPMemoryWriterInit(&memory_writer);
|
||||||
if (!WebPPictureInit(&picture) ||
|
if (!WebPPictureInit(&picture) ||
|
||||||
!WebPPictureInit(&original_picture) ||
|
!WebPPictureInit(&original_picture) ||
|
||||||
!WebPConfigInit(&config)) {
|
!WebPConfigInit(&config)) {
|
||||||
@ -897,7 +898,6 @@ int main(int argc, const char *argv[]) {
|
|||||||
picture.writer = MyWriter;
|
picture.writer = MyWriter;
|
||||||
picture.custom_ptr = (void*)out;
|
picture.custom_ptr = (void*)out;
|
||||||
} else {
|
} else {
|
||||||
WebPMemoryWriterInit(&memory_writer);
|
|
||||||
picture.writer = WebPMemoryWrite;
|
picture.writer = WebPMemoryWrite;
|
||||||
picture.custom_ptr = (void*)&memory_writer;
|
picture.custom_ptr = (void*)&memory_writer;
|
||||||
}
|
}
|
||||||
@ -983,6 +983,7 @@ int main(int argc, const char *argv[]) {
|
|||||||
return_value = 0;
|
return_value = 0;
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
|
free(memory_writer.mem);
|
||||||
free(picture.extra_info);
|
free(picture.extra_info);
|
||||||
MetadataFree(&metadata);
|
MetadataFree(&metadata);
|
||||||
WebPPictureFree(&picture);
|
WebPPictureFree(&picture);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user