Patch attached so that getloadCB() isn't constantly malloc()ing memory that is never freed. Tested with valgrind.
tony
diff -uarb xsysinfo-1.7/xsysinfo.c xsysinfo-1.7_patch/xsysinfo.c --- xsysinfo-1.7/xsysinfo.c 1999-05-04 22:58:03.000000000 -0700 +++ xsysinfo-1.7_patch/xsysinfo.c 2007-03-07 11:49:20.000000000 -0800 @@ -116,11 +116,15 @@ XtPointer client_data; XtPointer call_data; { + static char cpuLoadBuffer[7]; struct load load; XgBarGaugeValues *gauge = (XgBarGaugeValues *) call_data; - load.cpu = (char *)malloc(7*sizeof(char)); - strcpy(load.cpu, (char *)client_data); + // 20070307 <[EMAIL PROTECTED]> + // this char buffer is never freed + //load.cpu = (char *)malloc(7*sizeof(char)); + load.cpu = cpuLoadBuffer; + strncpy(load.cpu, (char *)client_data, 7); get_load(&load); gauge->values[0] = norm(load.user, load.total);
signature.asc
Description: OpenPGP digital signature