fix two minor memory leaks in webpmux

(only occur in case of error)

Change-Id: Icab69bb364b77f8eae6cae91047354c27e610602
This commit is contained in:
skal 2013-05-22 00:58:53 +02:00
parent 47b9862f30
commit 3e59a74d72

View File

@ -231,11 +231,13 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
for (i = 1; i <= nFrames; i++) { for (i = 1; i <= nFrames; i++) {
WebPMuxFrameInfo frame; WebPMuxFrameInfo frame;
err = WebPMuxGetFrame(mux, i, &frame); err = WebPMuxGetFrame(mux, i, &frame);
RETURN_IF_ERROR3("Failed to retrieve %s#%d\n", type_str, i); if (err == WEBP_MUX_OK) {
printf("%3d: %8d %8d ", i, frame.x_offset, frame.y_offset); printf("%3d: %8d %8d ", i, frame.x_offset, frame.y_offset);
if (is_anim) printf("%8d %7d ", frame.duration, frame.dispose_method); if (is_anim) printf("%8d %7d ", frame.duration, frame.dispose_method);
printf("%10d\n", (int)frame.bitstream.size); printf("%10d\n", (int)frame.bitstream.size);
}
WebPDataClear(&frame.bitstream); WebPDataClear(&frame.bitstream);
RETURN_IF_ERROR3("Failed to retrieve %s#%d\n", type_str, i);
} }
} }
} }
@ -264,8 +266,11 @@ static WebPMuxError DisplayInfo(const WebPMux* mux) {
if ((flag & ALPHA_FLAG) && !(flag & (ANIMATION_FLAG | FRAGMENTS_FLAG))) { if ((flag & ALPHA_FLAG) && !(flag & (ANIMATION_FLAG | FRAGMENTS_FLAG))) {
WebPMuxFrameInfo image; WebPMuxFrameInfo image;
err = WebPMuxGetFrame(mux, 1, &image); err = WebPMuxGetFrame(mux, 1, &image);
if (err == WEBP_MUX_OK) {
printf("Size of the image (with alpha): %d\n", (int)image.bitstream.size);
}
WebPDataClear(&image.bitstream);
RETURN_IF_ERROR("Failed to retrieve the image\n"); RETURN_IF_ERROR("Failed to retrieve the image\n");
printf("Size of the image (with alpha): %d\n", (int)image.bitstream.size);
} }
return WEBP_MUX_OK; return WEBP_MUX_OK;