lkml.org 
[lkml]   [2014]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] perf tools: Allow deletion of a thread with no map groups
Date
It needs to be possible to call thread__delete() on
a thread with no map groups. This is needed for
a subsequent patch which deletes a thread on the
error path before map groups have been attached.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/thread.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 7a32f44..b9c36ef 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -60,8 +60,10 @@ void thread__delete(struct thread *thread)
{
struct comm *comm, *tmp;

- map_groups__put(thread->mg);
- thread->mg = NULL;
+ if (thread->mg) {
+ map_groups__put(thread->mg);
+ thread->mg = NULL;
+ }
list_for_each_entry_safe(comm, tmp, &thread->comm_list, list) {
list_del(&comm->list);
comm__free(comm);
--
1.8.3.2


\
 
 \ /
  Last update: 2014-07-16 10:01    [W:1.243 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site