summaryrefslogtreecommitdiff
blob: d8c6e556e1976d84ec88d26cac3736dad45c7050 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
http://defect.opensolaris.org/bz/show_bug.cgi?id=5482
http://sourceforge.net/tracker/?func=detail&aid=2593511&group_id=72892&atid=536042

--- top-3.8beta1/machine/m_sunos5.c
+++ top-3.8beta1/machine/m_sunos5.c
@@ -2059,11 +2059,11 @@
 	/* make sure we have a valid descriptor and the file's current size */
 	if (fd >= 0 && fstat(fd, &st) != -1)
 	{
-	    char *p;
+	    char *p, *p0;
 	    int i;
 
 	    /* read the whole file */
-	    p = malloc(st.st_size);
+	    p = p0 = malloc(st.st_size);
 	    (void)pread(fd, p, st.st_size, 0);
 
 	    /* cache the file descriptor if we can */
@@ -2148,7 +2148,7 @@
 		op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
 		op->seen = 1;
 	    }
-	    free(p);
+	    free(p0);
 	}
 #endif