[libgweather/wip/hadess/3.36.0: 1/3] yrno: xml parser leak fixes



commit d37b0cbdb6e47061ed9bcdae1a90a9bdeb6f7a20
Author: Sebastian Keller <skeller gnome org>
Date:   Wed Jan 22 18:09:27 2020 +0100

    yrno: xml parser leak fixes
    
    The result of xmlGetProp() needs to be freed by the caller.

 libgweather/weather-yrno.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/libgweather/weather-yrno.c b/libgweather/weather-yrno.c
index 6293a13..8324121 100644
--- a/libgweather/weather-yrno.c
+++ b/libgweather/weather-yrno.c
@@ -182,6 +182,7 @@ read_symbol (GWeatherInfo *info,
        priv->sky = symbol->sky;
        priv->cond = symbol->condition;
     }
+    xmlFree (val);
 }
 
 static inline void
@@ -200,9 +201,11 @@ read_wind_direction (GWeatherInfo *info,
     for (i = 0; i < G_N_ELEMENTS (wind_directions); i++) {
        if (strcmp ((char*) val, wind_directions[i].name) == 0) {
            info->priv->wind = wind_directions[i].direction;
+            xmlFree (val);
            return;
        }
     }
+    xmlFree (val);
 }
 
 static inline void
@@ -218,6 +221,7 @@ read_wind_speed (GWeatherInfo *info,
 
     mps = g_ascii_strtod ((char*) val, NULL);
     info->priv->windspeed = WINDSPEED_MS_TO_KNOTS (mps);
+    xmlFree (val);
 }
 
 static inline void
@@ -233,6 +237,7 @@ read_temperature (GWeatherInfo *info,
 
     celsius = g_ascii_strtod ((char*) val, NULL);
     info->priv->temp = TEMP_C_TO_F (celsius);
+    xmlFree (val);
 }
 
 static inline void
@@ -248,6 +253,7 @@ read_pressure (GWeatherInfo *info,
 
     hpa = g_ascii_strtod ((char*) val, NULL);
     info->priv->pressure = PRESSURE_MBAR_TO_INCH (hpa);
+    xmlFree (val);
 }
 
 static inline void
@@ -264,6 +270,7 @@ read_humidity (GWeatherInfo *info,
     percent = g_ascii_strtod ((char*) val, NULL);
     info->priv->humidity = percent;
     info->priv->hasHumidity = TRUE;
+    xmlFree (val);
 }
 
 static inline void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]