summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2017-07-01 12:54:17 +0200
committerJens Georg <mail@jensge.org>2017-07-01 13:03:49 +0200
commit181c8c6122faeb5a39a09e9f984463babb88d53f (patch)
tree85069a2da7df6f95a2a9d48b3333d0b634edfdd1
parentf1cc7c3b25202836f05343cec388331285de86dc (diff)
downloadgupnp-tools-181c8c6122faeb5a39a09e9f984463babb88d53f.tar.gz
common: Fix memory leak if there is no icon
-rw-r--r--src/common/icons.c9
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);