--- dwmstatus-temperature.c | 6 +++++- dwmstatus.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dwmstatus-temperature.c b/dwmstatus-temperature.c index 13f27f6..793c723 100644 --- a/dwmstatus-temperature.c +++ b/dwmstatus-temperature.c _AT_@ -6,10 +6,14 @@ char * gettemperature(char *base, char *sensor) { char *co; + float t; co = readfile(base, sensor); if (co == NULL) return smprintf(""); - return smprintf("%02.0f°C", atof(co) / 1000); + t = atof(co); + free(co); + + return smprintf("%02.0f°C", t / 1000); } diff --git a/dwmstatus.c b/dwmstatus.c index d2a4b03..9e2fd7e 100644 --- a/dwmstatus.c +++ b/dwmstatus.c _AT_@ -168,11 +168,15 @@ char * gettemperature(char *base, char *sensor) { char *co; + float t; co = readfile(base, sensor); if (co == NULL) return smprintf(""); - return smprintf("%02.0f°C", atof(co) / 1000); + t = atof(co); + free(co); + + return smprintf("%02.0f°C", t / 1000); } int -- 2.27.0Received on Thu Jun 11 2020 - 15:36:18 CEST
This archive was generated by hypermail 2.3.0 : Thu Jun 11 2020 - 15:48:31 CEST