]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/util/thread_map.c
Merge tag 'stable/frontswap.v16-tag' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / tools / perf / util / thread_map.c
index 84d9bd7820049cdcb641e0efc96f22a28b8f210a..9b5f856cc28096b865d1c34c12073a23e5eb5a9c 100644 (file)
@@ -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;