Quoting Vittorio Giovara (2015-03-07 11:24:06)
> On Sat, Mar 7, 2015 at 9:19 AM, Luca Barbato <[email protected]> wrote:
> > On 07/03/15 10:03, Vittorio Giovara wrote:
> >>
> >> Signed-off-by: Vittorio Giovara <[email protected]>
> >> ---
> >
> >
> >> +    ret = ff_mjpeg_decode_frame(avctx, ctx->jpgframe, &got_frame, &jpkt);
> >> +    if (ret < 0 || !got_frame || ctx->jpgframe->format !=
> >> AV_PIX_FMT_YUVJ420P) {
> >> +        av_log(avctx, AV_LOG_ERROR,
> >> +               "Jpeg decoding error (%d) for (%d) frame.\n",
> >> +               ret, got_frame);
> >> +
> >> +        /* Normally skip, error if explode */
> >> +        return -(avctx->err_recognition & AV_EF_EXPLODE);
> >
> >
> > if ()
> >     return AVERROR_INVALIDDATA;
> 
> it's if() return AVERROR_INVALIDDATA else return 0
> I'm not sure if it's even worth doing

Returning random numbers sure isn't a good idea.

> 
> >> +        ctx->tilebuffer = av_realloc(ctx->tilebuffer, tile_size);
> >> +        if (!ctx->tilebuffer)
> >> +            return AVERROR(ENOMEM);
> >> +}
> >
> >
> > use reallocp
> 
> is there any particular difference?

The fact that this code leaks on failure.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to