]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/utils: Don't forget cleaning up when allocating priv_data fails
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 24 Sep 2020 21:54:17 +0000 (23:54 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 1 Oct 2020 11:19:42 +0000 (13:19 +0200)
Allocating an AVCodecContext's priv_data used to be the first object
allocated in avcodec_open2(), so it was unnecessary to goto free_and_end
(which does the cleanup) upon error here. But this is no longer so since
f3a29b750a5979ae6847879fba758faf1fae88d0.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/utils.c

index a8af45d0c34c3f9487067e0687f28de3711e22b4..05064b560fc461cf6e810e4ad79d37acab42207e 100644 (file)
@@ -608,7 +608,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
             avctx->priv_data = av_mallocz(codec->priv_data_size);
             if (!avctx->priv_data) {
                 ret = AVERROR(ENOMEM);
-                goto end;
+                goto free_and_end;
             }
             if (codec->priv_class) {
                 *(const AVClass **)avctx->priv_data = codec->priv_class;