|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: Theoretical 'top' memory leak
From: Henrik Gustafsson (openbsd
fnord.se)
Date: Fri Sep 01 2006 - 12:07:44 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I blame the email client! :)
Let's hope this works better.
// Henrik
Index: usr.bin/top/machine.c
===================================================================
RCS file: /cvs/src/usr.bin/top/machine.c,v
retrieving revision 1.52
diff -u -r1.52 machine.c
--- usr.bin/top/machine.c 29 Apr 2006 14:40:44 -0000 1.52
+++ usr.bin/top/machine.c 1 Sep 2006 15:43:11 -0000

-717,7 +717,7 
int nswap, rnswap, i;
nswap = swapctl(SWAP_NSWAP, 0, 0);
- if (nswap == 0)
+ if (nswap <= 0)
return 0;
swdev = malloc(nswap * sizeof(*swdev));

-725,10 +725,10 
return 0;
rnswap = swapctl(SWAP_STATS, swdev, nswap);
- if (rnswap == -1)
+ if (rnswap == -1 || rnswap != nswap) {
+ free(swdev);
return 0;
-
- /* if rnswap != nswap, then what? */
+ }
/* Total things up */
*total = *used = 0;
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]