diff --git a/src/conky.c b/src/conky.c index bf0662e6..dd8bb509 100644 --- a/src/conky.c +++ b/src/conky.c @@ -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) diff --git a/src/linux.c b/src/linux.c index d03d0dea..af10179d 100644 --- a/src/linux.c +++ b/src/linux.c @@ -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))) {