hwcontext: Perform usual uninitialisation on derived frames contexts
authorMark Thompson <sw@jkqxz.net>
Mon, 26 Jun 2017 19:28:07 +0000 (20:28 +0100)
committerMark Thompson <sw@jkqxz.net>
Sun, 11 Feb 2018 22:11:10 +0000 (22:11 +0000)
libavutil/hwcontext.c

index cccbd62..34fb720 100644 (file)
@@ -205,19 +205,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);