mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/ljpegenc: Don't free buffer known to be NULL
The lossless JPEG encoder allocates one buffer in its init function and freeing said buffer is the only thing done in its close function. Despite this the init function called the close function if allocating said buffer fails, although there is nothing to free in this case. This commit stops doing this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
3d83de4187
commit
6015a6921e
@ -309,7 +309,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
|
|
||||||
s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch));
|
s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch));
|
||||||
if (!s->scratch)
|
if (!s->scratch)
|
||||||
goto fail;
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
ff_idctdsp_init(&s->idsp, avctx);
|
ff_idctdsp_init(&s->idsp, avctx);
|
||||||
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
|
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
|
||||||
@ -327,9 +327,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
avpriv_mjpeg_val_dc);
|
avpriv_mjpeg_val_dc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
|
||||||
ljpeg_encode_close(avctx);
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OFFSET(x) offsetof(LJpegEncContext, x)
|
#define OFFSET(x) offsetof(LJpegEncContext, x)
|
||||||
|
Loading…
Reference in New Issue
Block a user