From 6e95ef4c1c047bd505f9ad67cf22ffb25d69e233 Mon Sep 17 00:00:00 2001 From: Franck Bui-Huu Date: Fri, 25 May 2012 15:21:49 +0200 Subject: [PATCH] --- yaml --- r: 309418 b: refs/heads/master c: e8cdd947776300f962d5b699c34087af45a8aea7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/util/thread_map.c | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index e15903d20a9f..a3a1f0d6c05f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a83eb3ea97efbc891b2f67e91329638cd4e21622 +refs/heads/master: e8cdd947776300f962d5b699c34087af45a8aea7 diff --git a/trunk/tools/perf/util/thread_map.c b/trunk/tools/perf/util/thread_map.c index 84d9bd782004..9b5f856cc280 100644 --- a/trunk/tools/perf/util/thread_map.c +++ b/trunk/tools/perf/util/thread_map.c @@ -188,28 +188,27 @@ static struct thread_map *thread_map__new_by_pid_str(const char *pid_str) nt = realloc(threads, (sizeof(*threads) + sizeof(pid_t) * total_tasks)); if (nt == NULL) - goto out_free_threads; + goto out_free_namelist; threads = nt; - if (threads) { - for (i = 0; i < items; i++) - threads->map[j++] = atoi(namelist[i]->d_name); - threads->nr = total_tasks; - } - - for (i = 0; i < items; i++) + for (i = 0; i < items; i++) { + threads->map[j++] = atoi(namelist[i]->d_name); free(namelist[i]); + } + threads->nr = total_tasks; free(namelist); - - if (!threads) - break; } out: strlist__delete(slist); return threads; +out_free_namelist: + for (i = 0; i < items; i++) + free(namelist[i]); + free(namelist); + out_free_threads: free(threads); threads = NULL;