diff mbox series

[21/34] kernelshark: Fix potential access to uninitialized variable

Message ID 20240114171723.14092-22-dev@benjarobin.fr (mailing list archive)
State Accepted
Commit 3ef17e14b4a2f48fbaaba2a9d5c721f5e71c0585
Headers show
Series Fix kernelshark issues introduced by the migration to Qt6 | expand

Commit Message

Benjamin ROBIN Jan. 14, 2024, 5:17 p.m. UTC
Always call json_object_put() with a valid "jlist" pointer.

Signed-off-by: Benjamin ROBIN <dev@benjarobin.fr>
---
 src/libkshark-configio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/libkshark-configio.c b/src/libkshark-configio.c
index 853e056..49f957b 100644
--- a/src/libkshark-configio.c
+++ b/src/libkshark-configio.c
@@ -777,7 +777,7 @@  static bool kshark_plugin_from_json(struct kshark_context *kshark_ctx,
 static bool kshark_all_plugins_from_json(struct kshark_context *kshark_ctx,
 					 struct json_object *jobj)
 {
-	struct json_object *jlist, *jfile;
+	struct json_object *jlist = NULL, *jfile = NULL;
 	int i, n_plugins;
 
 	if (!kshark_ctx || !jobj)
@@ -902,7 +902,7 @@  static bool kshark_stream_plugins_from_json(struct kshark_context *kshark_ctx,
 	int i, n_plugins;
 	bool active;
 
-	jplg = jname = jstatus = NULL;
+	jlist = jplg = jname = jstatus = NULL;
 
 	if (!kshark_ctx || !stream || !jobj)
 		return false;