[FFmpeg-devel] vf_hwupload: Add missing return value checks

Submitted by Jun Zhao on Feb. 27, 2017, 2:18 a.m.

Details

Message ID 740c7871-4919-706b-7b41-d3d2ea645e39@gmail.com
State New
Headers show

Commit Message

Jun Zhao Feb. 27, 2017, 2:18 a.m.
From e60a958c78ba084e0745acebec5125394387c5b1 Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao@intel.com>
Date: Mon, 27 Feb 2017 10:08:36 +0800
Subject: [PATCH] vf_hwupload: Add missing return value checks

Add missing return value checks to fix the build warning.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
---
 libavfilter/vf_hwupload.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_hwupload.c b/libavfilter/vf_hwupload.c
index 08af2dd..ce39307 100644
--- a/libavfilter/vf_hwupload.c
+++ b/libavfilter/vf_hwupload.c
@@ -81,10 +81,12 @@  static int hwupload_query_formats(AVFilterContext *avctx)
         }
     }
 
-    ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats);
-
-    ff_formats_ref(ff_make_format_list(output_pix_fmts),
-                   &avctx->outputs[0]->in_formats);
+    if ((err = ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats)) < 0 ||
+        (err = ff_formats_ref(ff_make_format_list(output_pix_fmts),
+                              &avctx->outputs[0]->in_formats)) < 0) {
+        ff_formats_unref(&input_formats);
+        goto fail;
+    }
 
     av_hwframe_constraints_free(&constraints);
     return 0;