diff options
author | Jens Georg <mail@jensge.org> | 2022-11-02 16:35:31 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2022-11-02 16:35:31 +0100 |
commit | 8cc494c20575ae9be48d186407749805209c0f46 (patch) | |
tree | 327cfbc7e8f42010afa655c0f4eaf5d1d48312c4 | |
parent | d755b336bf0ee02497a833b017b5d1055ba05b12 (diff) | |
download | gssdp-8cc494c20575ae9be48d186407749805209c0f46.tar.gz |
net-posix: Do not leak mask if already provided
-rw-r--r-- | libgssdp/gssdp-net-posix.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libgssdp/gssdp-net-posix.c b/libgssdp/gssdp-net-posix.c index 3350b06..1dc1ae7 100644 --- a/libgssdp/gssdp-net-posix.c +++ b/libgssdp/gssdp-net-posix.c @@ -510,8 +510,16 @@ gssdp_net_get_host_ip (GSSDPNetworkDevice *device, GError **error) if (!equal) continue; - device->host_mask = get_netmask (ifa->ifa_addr, - ifa->ifa_netmask); + if (device->host_mask != NULL && + !g_inet_address_mask_matches (device->host_mask, + device->host_addr)) { + g_clear_object (&device->host_mask); + } + + if (device->host_mask == NULL) { + device->host_mask = + get_netmask (ifa->ifa_addr, ifa->ifa_netmask); + } if (device->iface_name == NULL) device->iface_name = g_strdup (ifa->ifa_name); |