From 0e7d2f3ecb32b43453efd197f45972e205bba8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Nicola?= Date: Mon, 13 Dec 2021 11:05:54 +0100 Subject: [PATCH] Fix: Check 'reader' for NULL before trying to unreference it during cleanup (#997) --- misc/table_driven_lsc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/table_driven_lsc.c b/misc/table_driven_lsc.c index 4a72c2007..d4153a17e 100644 --- a/misc/table_driven_lsc.c +++ b/misc/table_driven_lsc.c @@ -161,7 +161,7 @@ get_status_of_table_driven_lsc_from_json (const char *scan_id, int len) { JsonParser *parser; - JsonReader *reader; + JsonReader *reader = NULL; GError *err = NULL; gchar *ret = NULL; @@ -206,7 +206,8 @@ get_status_of_table_driven_lsc_from_json (const char *scan_id, json_reader_end_member (reader); cleanup: - g_object_unref (reader); + if (reader) + g_object_unref (reader); g_object_unref (parser); if (err != NULL) {