gentoo/sys-process/unixtop/files/unixtop-3.8_beta1-memleak-fix-v2.patch
Marty E. Plummer f04018ad35
sys-process/unixtop: epatch->PATCHES=()
Reworked patches to be -p1, and converted the two 'diff -c' context
style diffs to a 'diff -u' unified diff, both for greater readability
and a generally smaller filesize.

Package-Manager: Portage-2.3.31, Repoman-2.3.9
2018-04-23 17:53:17 +03:00

29 lines
730 B
Diff

https://hg.openindiana.org/upstream/oracle/userland-gate/raw-file/23c55a2f8a8e/components/top/patches/03.sunos5.patch
--- a/machine/m_sunos5.c
+++ b/machine/m_sunos5.c
@@ -2064,7 +2064,13 @@ getptable (struct prpsinfo *baseptr)
/* 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) != st.st_size)
+ {
+ (void) close(fd);
+ op->fd_lpsinfo = -1;
+ free(p);
+ continue;
+ }
/* cache the file descriptor if we can */
if (fd < maxfiles)
@@ -2148,7 +2154,7 @@ getptable (struct prpsinfo *baseptr)
op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
op->seen = 1;
}
- free(p);
+ free(prp);
}
#endif