1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

fixed memory leak in i8k, courtesy of brenden

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@204 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Jason Tan 2005-08-27 07:40:49 +00:00
parent d0325837d5
commit 9b1ec59cb3

View File

@ -432,11 +432,11 @@ void update_load_average()
#define PROC_I8K "/proc/i8k" #define PROC_I8K "/proc/i8k"
#define I8K_DELIM " " #define I8K_DELIM " "
static char *i8k_procbuf;
void update_i8k() void update_i8k()
{ {
FILE *fp; FILE *fp;
char *i8k_procbuf = (char*)malloc(128*sizeof(char)); i8k_procbuf = (char*)malloc(128*sizeof(char));
if ((fp = fopen(PROC_I8K,"r")) == NULL) { if ((fp = fopen(PROC_I8K,"r")) == NULL) {
CRIT_ERR("/proc/i8k doesn't exist! use insmod to make sure the kernel driver is loaded..."); CRIT_ERR("/proc/i8k doesn't exist! use insmod to make sure the kernel driver is loaded...");
} }
@ -458,6 +458,10 @@ void update_i8k()
i8k.right_fan_rpm = strtok(NULL,I8K_DELIM); i8k.right_fan_rpm = strtok(NULL,I8K_DELIM);
i8k.ac_status = strtok(NULL,I8K_DELIM); i8k.ac_status = strtok(NULL,I8K_DELIM);
i8k.buttons_status = strtok(NULL,I8K_DELIM); i8k.buttons_status = strtok(NULL,I8K_DELIM);
if(i8k_procbuf) {
free(i8k_procbuf);
}
} }