Make source cleah with cppcheck, except for mpc and sasl
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user