[libav-devel] [PATCH] lavc/libwebpenc: use WebPMemoryWriterClear()

Justin Ruggles justin.ruggles at gmail.com
Tue Jun 16 18:45:46 CEST 2015


On 06/16/2015 12:27 PM, Vittorio Giovara wrote:
> From: James Almer <jamrial at gmail.com>
>
> WebPMemoryWriterClear() must be used instead of free() when libwebp ABI version is > 0x0203
>
> Reviewed-by: Michael Niedermayer <michaelni at gmx.at>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>   libavcodec/libwebpenc.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/libavcodec/libwebpenc.c b/libavcodec/libwebpenc.c
> index 5283da5..4cb8dc3 100644
> --- a/libavcodec/libwebpenc.c
> +++ b/libavcodec/libwebpenc.c
> @@ -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);
>

LGTM

-Justin


More information about the libav-devel mailing list