mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
fix minor memleak when closing conky
This commit is contained in:
parent
1070c60768
commit
ce9d9e3298
@ -146,6 +146,7 @@ enum x_initialiser_state x_initialised = NO;
|
|||||||
static volatile int g_signal_pending;
|
static volatile int g_signal_pending;
|
||||||
/* Update interval */
|
/* Update interval */
|
||||||
double update_interval;
|
double update_interval;
|
||||||
|
void *global_cpu = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* prototypes for internally used functions */
|
/* prototypes for internally used functions */
|
||||||
@ -7609,6 +7610,7 @@ static void clean_up(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear_diskio_stats();
|
clear_diskio_stats();
|
||||||
|
if(global_cpu != NULL) free(global_cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int string_to_bool(const char *s)
|
static int string_to_bool(const char *s)
|
||||||
|
@ -617,6 +617,7 @@ inline static void update_stat(void)
|
|||||||
double curtmp;
|
double curtmp;
|
||||||
const char *stat_template = NULL;
|
const char *stat_template = NULL;
|
||||||
unsigned int malloc_cpu_size = 0;
|
unsigned int malloc_cpu_size = 0;
|
||||||
|
extern void* global_cpu;
|
||||||
|
|
||||||
/* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */
|
/* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */
|
||||||
if (!cpu_setup || !info.cpu_usage) {
|
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);
|
malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);
|
||||||
cpu = malloc(malloc_cpu_size);
|
cpu = malloc(malloc_cpu_size);
|
||||||
memset(cpu, 0, malloc_cpu_size);
|
memset(cpu, 0, malloc_cpu_size);
|
||||||
|
global_cpu = cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(stat_fp = open_file("/proc/stat", &rep))) {
|
if (!(stat_fp = open_file("/proc/stat", &rep))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user