lavc/libwebpenc: use WebPMemoryWriterClear()
authorJames Almer <jamrial@gmail.com>
Wed, 27 Aug 2014 18:39:50 +0000 (15:39 -0300)
committerJames Almer <jamrial@gmail.com>
Wed, 27 Aug 2014 18:42:13 +0000 (15:42 -0300)
WebPMemoryWriterClear() must be used instead of free() when libwebp ABI version is > 0x0203

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/libwebpenc.c

index 5283da5..4cb8dc3 100644 (file)
@@ -231,7 +231,11 @@ static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     *got_packet = 1;
 
 end:
+#if (WEBP_ENCODER_ABI_VERSION > 0x0203)
+    WebPMemoryWriterClear(&mw);
+#else
     free(mw.mem); /* must use free() according to libwebp documentation */
+#endif
     WebPPictureFree(pic);
     av_freep(&pic);
     av_frame_free(&alt_frame);