ports/92339: xosview port has a memory leak
Tom Pavel
pavel at alum.mit.edu
Thu Jan 26 02:40:03 UTC 2006
>Number: 92339
>Category: ports
>Synopsis: xosview port has a memory leak
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Jan 26 02:40:02 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Tom Pavel
>Release: 6.0-RELEASE
>Organization:
Network Physics
>Environment:
FreeBSD valiant.fractal.networkphysics.com 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov 3 09:36:13 UTC 2005 root at x64.samsco.home:/usr/obj/usr/src/sys/GENERIC i386
>Description:
The sysutils/xosview port that comes with 6.0 results in a memory leak that eventually crashes the xosview process. The CVS tree doesn't show any activity here more recent than 6.0. The attached extra patch to bsd/kernel.cc fixes the problem.
>How-To-Repeat:
>Fix:
--- work/xosview-1.8.2/bsd/kernel.cc.save Thu Jan 19 14:26:39 2006
+++ work/xosview-1.8.2/bsd/kernel.cc Fri Jan 20 16:35:35 2006
@@ -1006,8 +1006,8 @@
}
#else /* FreeBSD 5.x and 6.x */
/* This code is stolen from vmstat */
- unsigned long *kvm_intrcnt;
- char *kvm_intrname;
+ unsigned long *kvm_intrcnt, *base_intrcnt;
+ char *kvm_intrname, *base_intrname;
size_t inamlen, intrcntlen;
unsigned int i, nintr;
int d;
@@ -1020,6 +1020,10 @@
((kvm_intrname = (char *)malloc(inamlen)) == NULL))
err(1, "malloc()");
+ // keep track of the mem we're given:
+ base_intrcnt = kvm_intrcnt;
+ base_intrname = kvm_intrname;
+
safe_kvm_read (nlst[INTRCNT_SYM_INDEX].n_value, kvm_intrcnt, intrcntlen);
safe_kvm_read (nlst[INTRNAMES_SYM_INDEX].n_value, kvm_intrname, inamlen);
@@ -1035,6 +1039,10 @@
kvm_intrcnt++;
kvm_intrname += strlen(kvm_intrname) + 1;
}
+
+ // Doh! somebody needs to free this stuff too... (pavel 20-Jan-2006)
+ free(base_intrcnt);
+ free(base_intrname);
#endif
#elif defined (XOSVIEW_BSDI)
int nintr = 16;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list