avcodec: Free the default avoptions on init failure
authorLuca Barbato <lu_zero@gentoo.org>
Tue, 21 Apr 2015 16:17:38 +0000 (18:17 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Wed, 22 Apr 2015 10:27:13 +0000 (12:27 +0200)
libavcodec/utils.c

index 7740147..c9ae19b 100644 (file)
@@ -1292,6 +1292,10 @@ free_and_end:
         (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP))
         avctx->codec->close(avctx);
 
+    if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
+        av_opt_free(avctx->priv_data);
+    av_opt_free(avctx);
+
     av_dict_free(&tmp);
     av_freep(&avctx->priv_data);
     if (avctx->internal) {