From 1f7486f6999a44932d5fe706cd5979d901f85a9a Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Mon, 22 May 2006 03:26:44 +0000 Subject: [PATCH] bye warning, bye possible mem leak git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@653 7f574dfc-610e-0410-a909-a81674777703 --- src/conky.h | 1 + src/linux.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conky.h b/src/conky.h index 30db1e34..a228becc 100644 --- a/src/conky.h +++ b/src/conky.h @@ -481,6 +481,7 @@ void get_ibm_acpi_fan(char *buf, size_t client_buffer_size); void get_ibm_acpi_temps(void); void get_ibm_acpi_volume(char *buf, size_t client_buffer_size); void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size); +void get_cpu_count(); struct ibm_acpi_struct { unsigned int temps[8]; diff --git a/src/linux.c b/src/linux.c index 673667bd..9eeb657e 100644 --- a/src/linux.c +++ b/src/linux.c @@ -364,6 +364,9 @@ void determine_longstat(char * buf) { void get_cpu_count() { + if (info.cpu_usage) { + return; + } char buf[256]; if (stat_fp == NULL) stat_fp = open_file("/proc/stat", &rep); @@ -386,7 +389,6 @@ void get_cpu_count() } } info.cpu_usage = malloc((info.cpu_count + 1) * sizeof(float)); - } #define TMPL_LONGSTAT "%*s %llu %llu %llu %llu %llu %llu %llu %llu"