From 6beef589e32d874e5d961e7e6f7b2a68c56538bd Mon Sep 17 00:00:00 2001 From: RichardHitt Date: Wed, 9 Jan 2013 14:37:57 -0800 Subject: Make source cleah with cppcheck, except for mpc and sasl --- plugins/sysinfo/match.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins/sysinfo/match.c') diff --git a/plugins/sysinfo/match.c b/plugins/sysinfo/match.c index e40ac428..7d719738 100644 --- a/plugins/sysinfo/match.c +++ b/plugins/sysinfo/match.c @@ -37,7 +37,6 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo free_space = *free_k; total_space = *total_k; result = malloc(bsize * sizeof(char)); - bytesize = malloc(3 * sizeof(char)); const char *quantities = "KB\0MB\0GB\0TB\0PB\0EB\0ZB\0YB\0"; int i=0; if (total_space == 0) @@ -45,6 +44,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo snprintf(result, bsize, "%s: none", desc); return result; } + bytesize = malloc(3 * sizeof(char)); while (total_space > 1023 && i <= 14) { i=i+3; @@ -61,6 +61,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo else snprintf(result, bsize, "%s: %.1f%s/%.1f%s free", desc, free_space, bytesize, total_space, bytesize); + free (bytesize); return result; } -- cgit 1.4.1