aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-sched.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 20d887b222e4..dd714818fa4d 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -334,7 +334,12 @@ static struct task_desc *register_pid(struct perf_sched *sched,
334 pid_max = MAX_PID; 334 pid_max = MAX_PID;
335 BUG_ON((sched->pid_to_task = calloc(pid_max, sizeof(struct task_desc *))) == NULL); 335 BUG_ON((sched->pid_to_task = calloc(pid_max, sizeof(struct task_desc *))) == NULL);
336 } 336 }
337 BUG_ON(pid >= (unsigned long)pid_max); 337 if (pid >= (unsigned long)pid_max) {
338 BUG_ON((sched->pid_to_task = realloc(sched->pid_to_task, (pid + 1) *
339 sizeof(struct task_desc *))) == NULL);
340 while (pid >= (unsigned long)pid_max)
341 sched->pid_to_task[pid_max++] = NULL;
342 }
338 343
339 task = sched->pid_to_task[pid]; 344 task = sched->pid_to_task[pid];
340 345