libwebpenc: use WebPMemoryWriterClear()
authorJames Almer <jamrial@gmail.com>
Tue, 16 Jun 2015 16:27:20 +0000 (17:27 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 17 Jun 2015 13:13:43 +0000 (14:13 +0100)
WebPMemoryWriterClear() must be used instead of free() when
libwebp ABI version is > 0x0203.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/libwebpenc.c

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