1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

fix minor memleak when closing conky

This commit is contained in:
Nikolas Garofil 2009-07-07 17:27:57 +02:00
parent 1070c60768
commit ce9d9e3298
2 changed files with 4 additions and 0 deletions

View File

@ -146,6 +146,7 @@ enum x_initialiser_state x_initialised = NO;
static volatile int g_signal_pending;
/* Update interval */
double update_interval;
void *global_cpu = NULL;
/* prototypes for internally used functions */
@ -7609,6 +7610,7 @@ static void clean_up(void)
}
clear_diskio_stats();
if(global_cpu != NULL) free(global_cpu);
}
static int string_to_bool(const char *s)

View File

@ -617,6 +617,7 @@ inline static void update_stat(void)
double curtmp;
const char *stat_template = NULL;
unsigned int malloc_cpu_size = 0;
extern void* global_cpu;
/* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */
if (!cpu_setup || !info.cpu_usage) {
@ -633,6 +634,7 @@ inline static void update_stat(void)
malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);
cpu = malloc(malloc_cpu_size);
memset(cpu, 0, malloc_cpu_size);
global_cpu = cpu;
}
if (!(stat_fp = open_file("/proc/stat", &rep))) {