mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
gdbusaddress: Fix memory leak when G_DBUS_DEBUG_ADDRESS is enabled
Coverity CID: 1325374
This commit is contained in:
parent
0f98b2f4ec
commit
456e02f280
@ -1528,7 +1528,7 @@ g_dbus_address_get_for_bus_sync (GBusType bus_type,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gchar *ret;
|
||||
gchar *ret, *s = NULL;
|
||||
const gchar *starter_bus;
|
||||
GError *local_error;
|
||||
|
||||
@ -1541,8 +1541,10 @@ g_dbus_address_get_for_bus_sync (GBusType bus_type,
|
||||
{
|
||||
guint n;
|
||||
_g_dbus_debug_print_lock ();
|
||||
s = _g_dbus_enum_to_string (G_TYPE_BUS_TYPE, bus_type);
|
||||
g_print ("GDBus-debug:Address: In g_dbus_address_get_for_bus_sync() for bus type '%s'\n",
|
||||
_g_dbus_enum_to_string (G_TYPE_BUS_TYPE, bus_type));
|
||||
s);
|
||||
g_free (s);
|
||||
for (n = 0; n < 3; n++)
|
||||
{
|
||||
const gchar *k;
|
||||
@ -1629,18 +1631,18 @@ g_dbus_address_get_for_bus_sync (GBusType bus_type,
|
||||
if (G_UNLIKELY (_g_dbus_debug_address ()))
|
||||
{
|
||||
_g_dbus_debug_print_lock ();
|
||||
s = _g_dbus_enum_to_string (G_TYPE_BUS_TYPE, bus_type);
|
||||
if (ret != NULL)
|
||||
{
|
||||
g_print ("GDBus-debug:Address: Returning address '%s' for bus type '%s'\n",
|
||||
ret,
|
||||
_g_dbus_enum_to_string (G_TYPE_BUS_TYPE, bus_type));
|
||||
ret, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("GDBus-debug:Address: Cannot look-up address bus type '%s': %s\n",
|
||||
_g_dbus_enum_to_string (G_TYPE_BUS_TYPE, bus_type),
|
||||
local_error ? local_error->message : "");
|
||||
s, local_error ? local_error->message : "");
|
||||
}
|
||||
g_free (s);
|
||||
_g_dbus_debug_print_unlock ();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user