summary refs log tree commit diff stats
path: root/plugins
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-01-09 19:53:26 -0800
committerTingPing <tingping@tingping.se>2013-01-09 19:53:26 -0800
commitba2927e3c5e797160be7dee8d90b78d035b76c93 (patch)
tree13d1891e6507aa6d28fef5a407821aa141e554e0 /plugins
parented786843de94359a0f3dd9ccea1d3796c3a33d12 (diff)
parent672dbf75d6d3d47135be49568ebcce917d6c188c (diff)
Merge pull request #368 from RichardHitt/pull360
Make source clean with cppcheck, except for mpc and sasl, closes #360
Diffstat (limited to 'plugins')
-rw-r--r--plugins/checksum/checksum.c1
-rw-r--r--plugins/python/python.c1
-rw-r--r--plugins/sysinfo/match.c3
-rw-r--r--plugins/sysinfo/parse.c9
4 files changed, 8 insertions, 6 deletions
diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c
index 492367f6..08d62773 100644
--- a/plugins/checksum/checksum.c
+++ b/plugins/checksum/checksum.c
@@ -108,6 +108,7 @@ sha256_file (char *path, char outputBuffer[65])
 
 	if (!buffer)
 	{
+		fclose (file);
 		return ENOMEM;
 	}
 
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 0ff669b6..2e298c35 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -2137,6 +2137,7 @@ Command_PyReload(char *name)
 		char *filename = strdup(plugin->filename);
 		Command_PyUnload(filename);
 		Command_PyLoad(filename);
+		/* cppcheck-suppress deallocDealloc */
 		g_free(filename);
 	}
 }
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;
 }
 
diff --git a/plugins/sysinfo/parse.c b/plugins/sysinfo/parse.c
index fbca6213..c1b478f8 100644
--- a/plugins/sysinfo/parse.c
+++ b/plugins/sysinfo/parse.c
@@ -394,6 +394,7 @@ int xs_parse_distro(char *name)
 		char keywords[bsize];
 		while(fgets(buffer, bsize, fp) != NULL)
 			find_match_char(buffer, "ACCEPT_KEYWORDS", keywords);
+		/* cppcheck-suppress uninitvar */
 		if (strstr(keywords, "\"") == NULL)
 			snprintf(buffer, bsize, "Gentoo Linux (stable)");
 		else
@@ -440,16 +441,14 @@ int xs_parse_hwmon_chip(char *chip)
 
 int xs_parse_hwmon_temp(char *temp, unsigned int *sensor)
 {
-	unsigned int *value;
+	unsigned int value;
 	float celsius;
-        value = malloc(sizeof(int));
 
 	if (!hwmon_chip_present())
 		return 1;
 	else
-		get_hwmon_temp(value, sensor);
-		celsius = (float)*value;
+		get_hwmon_temp(&value, sensor);
+		celsius = (float)value;
 		snprintf(temp, bsize, "%.1fC", celsius/1000.0);
-		free(value);
 	return 0;
 }