From 3872bafeef60249868737aefbcd7f3c083cfb99a Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Sun, 3 Jun 2007 09:18:54 +0000 Subject: [PATCH] Fixed memory leaks found with valgrind git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@875 7f574dfc-610e-0410-a909-a81674777703 --- src/conky.c | 1 + src/top.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conky.c b/src/conky.c index 2e3b9fa6..8e8719d0 100644 --- a/src/conky.c +++ b/src/conky.c @@ -7250,6 +7250,7 @@ int main(int argc, char **argv) for (x = 0; x < strlen(s); x++) { temp[x] = tolower(s[x]); } + temp[x] = 0; if (strstr(temp, "utf-8") || strstr(temp, "utf8")) { utf8_mode = 1; } diff --git a/src/top.c b/src/top.c index 9faf8261..e046c50f 100644 --- a/src/top.c +++ b/src/top.c @@ -103,7 +103,7 @@ static int process_parse_stat(struct process *process) { struct information *cur; cur = &info; - char line[BUFFER_LEN], filename[BUFFER_LEN], procname[BUFFER_LEN]; + char line[BUFFER_LEN] = { 0 }, filename[BUFFER_LEN], procname[BUFFER_LEN]; int ps; unsigned long user_time = 0; unsigned long kernel_time = 0; @@ -356,7 +356,7 @@ static unsigned long long calc_cpu_total() unsigned long long t = 0; int rc; int ps; - char line[BUFFER_LEN]; + char line[BUFFER_LEN] = { 0 }; unsigned long long cpu = 0; unsigned long long nice = 0; unsigned long long system = 0;