[FFmpeg-devel] [PATCH 3/4] Implement dynamic memory allocation for MJPEG's picture

Ronald S. Bultje rsbultje
Mon Feb 28 16:34:23 CET 2011


Hi,

On Mon, Feb 28, 2011 at 9:19 AM, Anatoly Nenashev
<anatoly.nenashev at ovsoft.ru> wrote:
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index d146973..7f2d907 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -81,6 +81,11 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
>  {
>      MJpegDecodeContext *s = avctx->priv_data;
>
> +    if (!s->picture_ptr) {
> +        s->picture_ptr = &s->picture;

Why the if?

> +        s->picture_ptr->reference = 0;

Unnecessary, all memory is zero'ed on init.

Ronald



More information about the ffmpeg-devel mailing list