[gssdp/gssdp_1.0] client: Use g_realloc instead of g_malloc
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gssdp/gssdp_1.0] client: Use g_realloc instead of g_malloc
- Date: Sun, 5 Jul 2020 12:34:31 +0000 (UTC)
commit 135680779fc235f7a64ffb0eed9e7a3d7da4af2c
Author: Jens Georg <mail jensge org>
Date: Sun Jul 5 14:34:10 2020 +0200
client: Use g_realloc instead of g_malloc
libgssdp/gssdp-client.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 735caf7..ff3305f 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -1618,19 +1618,17 @@ get_host_ip (GSSDPNetworkDevice *device)
GAA_FLAG_SKIP_MULTICAST;
DWORD size = 15360; /* Use 15k buffer initially as documented in MSDN */
DWORD ret;
- PIP_ADAPTER_ADDRESSES adapters_addresses;
+ PIP_ADAPTER_ADDRESSES adapters_addresses = NULL;
PIP_ADAPTER_ADDRESSES adapter;
gboolean retval = FALSE;
do {
- adapters_addresses = (PIP_ADAPTER_ADDRESSES) g_malloc0 (size);
+ adapters_addresses = (PIP_ADAPTER_ADDRESSES) g_realloc (adapters_addresses, size);
ret = GetAdaptersAddresses (AF_UNSPEC,
flags,
NULL,
adapters_addresses,
&size);
- if (ret == ERROR_BUFFER_OVERFLOW)
- g_free (adapters_addresses);
} while (ret == ERROR_BUFFER_OVERFLOW);
if (ret == ERROR_SUCCESS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]