summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/print_cpu_temperature.c10
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);