From b57df4cfd12c23539612f38a77e9007bee61d2e7 Mon Sep 17 00:00:00 2001 From: Mengkejiergeli Ba Date: Wed, 13 Oct 2021 17:17:44 +0800 Subject: [PATCH] tests:va: Fix null ptr dereference in multi-vpp Dereference the pointer err before null check, which raised a null pointer dereference issue by Coverity. Modify it to do the null check of err first, then dereference it. Part-of: --- .../gst-plugins-bad/tests/examples/va/multiple-vpp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/tests/examples/va/multiple-vpp.c b/subprojects/gst-plugins-bad/tests/examples/va/multiple-vpp.c index 05d680e5cb..175327e137 100644 --- a/subprojects/gst-plugins-bad/tests/examples/va/multiple-vpp.c +++ b/subprojects/gst-plugins-bad/tests/examples/va/multiple-vpp.c @@ -140,12 +140,15 @@ message_handler (GstBus * bus, GstMessage * msg, gpointer data) GError *err = NULL; gst_message_parse_error (msg, &err, &debug); - gst_printerrln ("GStreamer error: %s\n%s", err->message, - debug ? debug : ""); + + if (err) { + gst_printerrln ("GStreamer error: %s\n%s", err->message, + debug ? debug : ""); + g_error_free (err); + } + if (debug) g_free (debug); - if (err) - g_error_free (err); g_main_loop_quit (app->loop); break;