[gupnp-tools] common: Fix memory leak if there is no icon



commit 181c8c6122faeb5a39a09e9f984463babb88d53f
Author: Jens Georg <mail jensge org>
Date:   Sat Jul 1 12:54:17 2017 +0200

    common: Fix memory leak if there is no icon

 src/common/icons.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/common/icons.c b/src/common/icons.c
index 4fe76f9..b3c9c69 100644
--- a/src/common/icons.c
+++ b/src/common/icons.c
@@ -130,8 +130,7 @@ schedule_icon_update (GUPnPDeviceInfo            *info,
         GetIconURLData *data;
         char           *icon_url;
 
-        data = g_slice_new (GetIconURLData);
-
+        data = g_slice_new0 (GetIconURLData);
         icon_url = gupnp_device_info_get_icon_url
                         (info,
                          NULL,
@@ -143,8 +142,12 @@ schedule_icon_update (GUPnPDeviceInfo            *info,
                          NULL,
                          &data->width,
                          &data->height);
-        if (icon_url == NULL)
+        if (icon_url == NULL) {
+                g_free (data->mime_type);
+                g_slice_free (GetIconURLData, data);
+
                 return;
+        }
 
         data->message = soup_message_new (SOUP_METHOD_GET, icon_url);
 


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