Hi Steven, Should I send this patch again? Thanks! Yordan On 11.07.2018 17:08, Yordan Karadzhov (VMware) wrote:
What about doing it this way:diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.cindex 668b6df8..34daa25e 100644 --- a/kernel-shark-qt/src/libkshark.c +++ b/kernel-shark-qt/src/libkshark.c@@ -303,12 +303,17 @@ ssize_t kshark_get_task_pids(struct kshark_context *kshark_ctx, int **pids)} } - temp_pids = realloc(*pids, pid_count * sizeof(int)); - if (!temp_pids) - goto fail; + if (pid_count) { + temp_pids = realloc(*pids, pid_count * sizeof(int)); + if (!temp_pids) + goto fail;- /* Paranoid: In the unlikely case of shrinking *pids, realloc moves it */- *pids = temp_pids;+ /* Paranoid: In the unlikely case of shrinking *pids, realloc moves it */+ *pids = temp_pids; + } else { + free(*pids); + *pids = NULL; + } return pid_count;Yes, this way is better. Thanks! Yordan? -- Steve