--- a/components/top/patches/03.sunos5.patch Wed Aug 31 12:42:31 2011 -0700
+++ b/components/top/patches/03.sunos5.patch Wed Aug 31 13:46:18 2011 -0700
@@ -1,17 +1,42 @@
---- top-3.8beta1/machine/m_sunos5.c.orig Fri Jun 17 05:40:25 2011
-+++ top-3.8beta1/machine/m_sunos5.c Fri Jun 17 05:48:17 2011
-@@ -2064,7 +2064,13 @@
-
- /* read the whole file */
- p = malloc(st.st_size);
-- (void)pread(fd, p, st.st_size, 0);
-+ if (pread(fd, p, st.st_size, 0) == -1)
-+ {
-+ (void) close(fd);
-+ op->fd_psinfo = -1;
-+ free(p);
-+ continue;
-+ }
-
- /* cache the file descriptor if we can */
- if (fd < maxfiles)
+*** top-3.8beta1/machine/m_sunos5.c.orig Wed Aug 31 05:23:52 2011
+--- top-3.8beta1/machine/m_sunos5.c Wed Aug 31 05:25:25 2011
+***************
+*** 2064,2070 ****
+
+ /* read the whole file */
+ p = malloc(st.st_size);
+! (void)pread(fd, p, st.st_size, 0);
+
+ /* cache the file descriptor if we can */
+ if (fd < maxfiles)
+--- 2064,2076 ----
+
+ /* read the whole file */
+ p = malloc(st.st_size);
+! if (pread(fd, p, st.st_size, 0) == -1)
+! {
+! (void) close(fd);
+! op->fd_psinfo = -1;
+! free(p);
+! continue;
+! }
+
+ /* cache the file descriptor if we can */
+ if (fd < maxfiles)
+***************
+*** 2148,2154 ****
+ op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
+ op->seen = 1;
+ }
+! free(p);
+ }
+ #endif
+
+--- 2154,2160 ----
+ op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
+ op->seen = 1;
+ }
+! free(prp);
+ }
+ #endif
+