linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kernel-shark-qt: Deal with the "no tasks" case in kshark_get_task_pids()
@ 2018-07-11 13:37 Yordan Karadzhov (VMware)
  2018-07-11 13:37 ` [PATCH 2/2] kernel-shark-qt: Fix the default value of the Event Visible flag Yordan Karadzhov (VMware)
  2018-07-11 14:02 ` [PATCH 1/2] kernel-shark-qt: Deal with the "no tasks" case in kshark_get_task_pids() Steven Rostedt
  0 siblings, 2 replies; 9+ messages in thread
From: Yordan Karadzhov (VMware) @ 2018-07-11 13:37 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

kshark_get_task_pids() should not return a "memory allocation" error
in the case when it is called before having trace data loaded.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/src/libkshark.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c
index 668b6df..75b88c9 100644
--- a/kernel-shark-qt/src/libkshark.c
+++ b/kernel-shark-qt/src/libkshark.c
@@ -303,6 +303,12 @@ ssize_t kshark_get_task_pids(struct kshark_context *kshark_ctx, int **pids)
 		}
 	}
 
+	if (!pid_count) {
+		free(*pids);
+		*pids = NULL;
+		return pid_count;
+	}
+
 	temp_pids = realloc(*pids, pid_count * sizeof(int));
 	if (!temp_pids)
 		goto fail;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-08-03 20:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 13:37 [PATCH 1/2] kernel-shark-qt: Deal with the "no tasks" case in kshark_get_task_pids() Yordan Karadzhov (VMware)
2018-07-11 13:37 ` [PATCH 2/2] kernel-shark-qt: Fix the default value of the Event Visible flag Yordan Karadzhov (VMware)
2018-07-11 14:04   ` Steven Rostedt
2018-07-11 14:02 ` [PATCH 1/2] kernel-shark-qt: Deal with the "no tasks" case in kshark_get_task_pids() Steven Rostedt
2018-07-11 14:08   ` Yordan Karadzhov (VMware)
2018-08-03 13:06     ` Yordan Karadzhov (VMware)
2018-08-03 17:46       ` Steven Rostedt
2018-08-03 18:18         ` Steven Rostedt
2018-08-03 18:22           ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).