[glib: 5/13] gdbusaddress: Clean up memory management in _g_dbus_address_parse_entry()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 5/13] gdbusaddress: Clean up memory management in _g_dbus_address_parse_entry()
- Date: Tue, 19 Mar 2019 10:54:21 +0000 (UTC)
commit e458b0168e164928eaba6ce7a1180576c2dc221b
Author: Philip Withnall <withnall endlessm com>
Date: Fri Mar 15 14:20:54 2019 +0000
gdbusaddress: Clean up memory management in _g_dbus_address_parse_entry()
This introduces no functional changes.
Signed-off-by: Philip Withnall <withnall endlessm com>
gio/gdbusaddress.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
index 756f1c0f3..1f7d19396 100644
--- a/gio/gdbusaddress.c
+++ b/gio/gdbusaddress.c
@@ -516,24 +516,18 @@ _g_dbus_address_parse_entry (const gchar *address_entry,
ret = TRUE;
out:
- g_strfreev (kv_pairs);
if (ret)
{
if (out_transport_name != NULL)
- *out_transport_name = transport_name;
- else
- g_free (transport_name);
+ *out_transport_name = g_steal_pointer (&transport_name);
if (out_key_value_pairs != NULL)
- *out_key_value_pairs = key_value_pairs;
- else if (key_value_pairs != NULL)
- g_hash_table_unref (key_value_pairs);
- }
- else
- {
- g_free (transport_name);
- if (key_value_pairs != NULL)
- g_hash_table_unref (key_value_pairs);
+ *out_key_value_pairs = g_steal_pointer (&key_value_pairs);
}
+
+ g_clear_pointer (&key_value_pairs, g_hash_table_unref);
+ g_free (transport_name);
+ g_strfreev (kv_pairs);
+
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]