On Sat, Mar 7, 2015 at 11:24 AM, Vittorio Giovara <[email protected]> wrote: > 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
At the very least it gives a consistent error value, isn't that something I see random patches for all the time? > >>> + ctx->tilebuffer = av_realloc(ctx->tilebuffer, tile_size); >>> + if (!ctx->tilebuffer) >>> + return AVERROR(ENOMEM); >>> +} >> >> >> use reallocp > > is there any particular difference? reallocp doesn't leak the original pointer if the realloc fails, your code does. :) - Hendrik _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
