summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-06 18:18:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-06 18:43:38 +0200
commit7ddbb4e23a4d591ab35594418fa250cc54c8df58 (patch)
tree376b1a6c212013539a706b087fc545c68370989c /libavcodec/pthread_frame.c
parentf79cd98caf362988e6c30fbd14da26231cd2341c (diff)
avcodec/pthread_frame: Fix memleak with frame threads and allocated AVOptions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 5a4ab84a4a..e80990558b 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -48,6 +48,7 @@
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
+#include "libavutil/opt.h"
/**
* Context used by codec threads and stored in their AVCodecInternal thread_ctx.
@@ -574,8 +575,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
if (codec->close)
codec->close(p->avctx);
- avctx->codec = NULL;
-
release_delayed_buffers(p);
av_frame_free(&p->frame);
}
@@ -603,6 +602,10 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
av_freep(&fctx->threads);
pthread_mutex_destroy(&fctx->buffer_mutex);
av_freep(&avctx->internal->thread_ctx);
+
+ if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
+ av_opt_free(avctx->priv_data);
+ avctx->codec = NULL;
}
int ff_frame_thread_init(AVCodecContext *avctx)