diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2013-10-24 19:19:21 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2013-10-24 19:19:21 +0200 |
commit | ebfafc5dac9cb15ec4ec9b13e9b933c9c2c5d5c9 (patch) | |
tree | 653cb2c6cccd910866573a757bbe35c625451cc7 /src | |
parent | c6e9fc84c6a7213b31d9e2790ea36d42ee10e809 (diff) |
print_cpu_temperature: fix memory leak (Thanks kuba)
Diffstat (limited to 'src')
-rw-r--r-- | src/print_cpu_temperature.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index 8bd39a4..6b8aa59 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -50,10 +50,12 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const const char *walk; bool colorful_output = false; - if (path == NULL) - asprintf(&thermal_zone, THERMAL_ZONE, zone); - else - asprintf(&thermal_zone, path, zone); + if (thermal_zone == NULL) { + if (path == NULL) + asprintf(&thermal_zone, THERMAL_ZONE, zone); + else + asprintf(&thermal_zone, path, zone); + } path = thermal_zone; INSTANCE(path); |