summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-15 02:09:42 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-19 18:47:54 +0200
commit6015a6921eba7b01b1e23ebd46f0f9f14b6c6f7b (patch)
treeae8c6a7600ab7f23318b5a41eae0ee9fa58b4d91 /libavcodec
parent3d83de4187e9bb07af2ea8a0ec071094fca7a500 (diff)
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ljpegenc.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 70eff9e6fe..39ce5a0089 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -309,7 +309,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch));
if (!s->scratch)
- goto fail;
+ return AVERROR(ENOMEM);
ff_idctdsp_init(&s->idsp, avctx);
ff_init_scantable(s->idsp.idct_permutation, &s->scantable,
@@ -327,9 +327,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
avpriv_mjpeg_val_dc);
return 0;
-fail:
- ljpeg_encode_close(avctx);
- return AVERROR(ENOMEM);
}
#define OFFSET(x) offsetof(LJpegEncContext, x)