Commit 7ddbb4e2 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pthread_frame: Fix memleak with frame threads and allocated AVOptions

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f79cd98c
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/log.h" #include "libavutil/log.h"
#include "libavutil/mem.h" #include "libavutil/mem.h"
#include "libavutil/opt.h"
/** /**
* Context used by codec threads and stored in their AVCodecInternal thread_ctx. * 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) ...@@ -574,8 +575,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
if (codec->close) if (codec->close)
codec->close(p->avctx); codec->close(p->avctx);
avctx->codec = NULL;
release_delayed_buffers(p); release_delayed_buffers(p);
av_frame_free(&p->frame); av_frame_free(&p->frame);
} }
...@@ -603,6 +602,10 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) ...@@ -603,6 +602,10 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
av_freep(&fctx->threads); av_freep(&fctx->threads);
pthread_mutex_destroy(&fctx->buffer_mutex); pthread_mutex_destroy(&fctx->buffer_mutex);
av_freep(&avctx->internal->thread_ctx); 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) int ff_frame_thread_init(AVCodecContext *avctx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment