=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/machine.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- src/usr.bin/top/machine.c 2001/02/17 23:01:40 1.22 +++ src/usr.bin/top/machine.c 2001/02/22 03:10:24 1.23 @@ -1,4 +1,4 @@ -/* $OpenBSD: machine.c,v 1.22 2001/02/17 23:01:40 deraadt Exp $ */ +/* $OpenBSD: machine.c,v 1.23 2001/02/22 03:10:24 deraadt Exp $ */ /* * top - a top users display for Unix @@ -277,13 +277,15 @@ size_t size = 0; int mib[4] = {CTL_KERN, KERN_PROC, op, arg}; int st, nprocs; - struct kinfo_proc *procbase; + static struct kinfo_proc *procbase; st = sysctl(mib, 4, NULL, &size, NULL, 0); if (st == -1) { /* _kvm_syserr(kd, kd->program, "kvm_getprocs"); */ return (0); } + if (procbase) + free(procbase); procbase = (struct kinfo_proc *)malloc(size); if (procbase == NULL) return (0);