diff mbox series

[1/8] kernel-shark: Don't free the string field of KS_CONFIG_STRING document

Message ID 20190709155650.2345-2-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series Fixes needed befor KS 1.0 | expand

Commit Message

Yordan Karadzhov July 9, 2019, 3:56 p.m. UTC
In kshark_config_doc_get() if the outputted document is of type
KS_CONFIG_STRING, do not try to free the old string before setting
the new one. Note that those strings are owned by the json object.

Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Fixes: 	b3b5b6504b1 ("kernel-shark-qt: Add I/O for configuration data.")
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/libkshark-configio.c | 1 -
 1 file changed, 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel-shark/src/libkshark-configio.c b/kernel-shark/src/libkshark-configio.c
index 9106522..cac27a7 100644
--- a/kernel-shark/src/libkshark-configio.c
+++ b/kernel-shark/src/libkshark-configio.c
@@ -310,7 +310,6 @@  bool kshark_config_doc_get(struct kshark_config_doc *conf,
 			if (!get_jval(conf, key, &tmp->conf_doc))
 				goto fail;
 
-			free(val->conf_doc);
 			val->conf_doc =
 				(char *) json_object_get_string(tmp->conf_doc);
 			free(tmp);