From: Michael Stapelberg Date: Thu, 24 Oct 2013 17:19:21 +0000 (+0200) Subject: print_cpu_temperature: fix memory leak (Thanks kuba) X-Git-Tag: 2.8~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ebfafc5dac9cb15ec4ec9b13e9b933c9c2c5d5c9;p=i3%2Fi3status print_cpu_temperature: fix memory leak (Thanks kuba) --- 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);