[FFmpeg-devel,14/14] hwcontext: Perform usual uninitialisation on derived frames contexts

Submitted by Mark Thompson on Sept. 10, 2017, 8:53 p.m.

Details

Message ID 20170910205338.29687-15-sw@jkqxz.net
State Accepted
Commit 0f93cef2d6405f07b42719506cbde30f07dd8702
Headers show

Commit Message

Mark Thompson Sept. 10, 2017, 8:53 p.m.
---
 libavutil/hwcontext.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 77cf68fe2e..4d0b2a1998 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -216,19 +216,16 @@  static void hwframe_ctx_free(void *opaque, uint8_t *data)
 {
     AVHWFramesContext *ctx = (AVHWFramesContext*)data;
 
-    if (ctx->internal->source_frames) {
-        av_buffer_unref(&ctx->internal->source_frames);
+    if (ctx->internal->pool_internal)
+        av_buffer_pool_uninit(&ctx->internal->pool_internal);
 
-    } else {
-        if (ctx->internal->pool_internal)
-            av_buffer_pool_uninit(&ctx->internal->pool_internal);
+    if (ctx->internal->hw_type->frames_uninit)
+        ctx->internal->hw_type->frames_uninit(ctx);
 
-        if (ctx->internal->hw_type->frames_uninit)
-            ctx->internal->hw_type->frames_uninit(ctx);
+    if (ctx->free)
+        ctx->free(ctx);
 
-        if (ctx->free)
-            ctx->free(ctx);
-    }
+    av_buffer_unref(&ctx->internal->source_frames);
 
     av_buffer_unref(&ctx->device_ref);