ps: fix crash related to realloc -- thanks David Houlder

This commit is contained in:
albert 2005-09-12 03:25:01 +00:00
parent a402ba1848
commit 6a304370f8
2 changed files with 4 additions and 1 deletions

1
NEWS
View File

@ -4,6 +4,7 @@ top can do per-task display -- thanks John Blackwood rh114012
more MIPS crud -- thanks Jim Gifford and Ryan Oliver
begin prep for setuid
top: fix %CPU max on 2..9 CPU SMP -- thanks Ga*tan LEURENT
ps: fix crash related to realloc -- thanks David Houlder
procps-3.2.4 --> procps-3.2.5

View File

@ -939,9 +939,11 @@ proc_data_t *readproctab2(int(*want_proc)(proc_t *buf), int(*want_task)(proc_t *
for(;;){
proc_t *t;
if(n_alloc == n_used){
//proc_t *old = data;
proc_t *old = data;
n_alloc = n_alloc*5/4+30; // grow by over 25%
data = realloc(data,sizeof(proc_t)*n_alloc);
// have to move tmp too
tmp = data+(tmp-old);
//if(!data) return NULL;
}
if(n_task_alloc == n_task){