summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-06-05 13:18:17 +0200
committerAnton Khirnov <anton@khirnov.net>2011-06-05 15:01:36 +0200
commit367732832faaf1bac4ece37cf7fef8c911e16312 (patch)
tree3e3cf5d1809f898f9f25dca63b2e2f8117424bde /libavcodec/utils.c
parentb39b06233dfd69b941a32f29171dfb63abb23c06 (diff)
lavf,lavc: free avoptions in a generic way.
It's simpler and less error-prone. Fixes some memleaks along the way.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 65792a6f5a..2b417defbf 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -783,6 +783,9 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->codec->close(avctx);
avcodec_default_free_buffers(avctx);
avctx->coded_frame = NULL;
+ if (avctx->codec->priv_class)
+ av_opt_free(avctx->priv_data);
+ av_opt_free(avctx);
av_freep(&avctx->priv_data);
if(avctx->codec && avctx->codec->encode)
av_freep(&avctx->extradata);