Plug a mem leak in gdbusauth
authorChristian Persch <chpe@gnome.org>
Fri, 14 May 2010 16:21:01 +0000 (18:21 +0200)
committerChristian Persch <chpe@gnome.org>
Fri, 14 May 2010 22:12:18 +0000 (00:12 +0200)
From valgrind running gdbus-peer test:

==20513== 32 bytes in 1 blocks are definitely lost in loss record 1 of 15
==20513==    at 0x4024E4C: realloc (vg_replace_malloc.c:429)
==20513==    by 0x4079BB1: g_realloc (gmem.c:174)
==20513==    by 0x4099472: g_string_maybe_expand (gstring.c:396)
==20513==    by 0x409A42A: g_string_insert_c (gstring.c:1050)
==20513==    by 0x42169AC: g_string_append_c_inline (gstring.h:153)
==20513==    by 0x421682C: _my_g_input_stream_read_line_safe (gdbusauth.c:336)
==20513==    by 0x421843E: _g_dbus_auth_run_server (gdbusauth.c:1265)
==20513==    by 0x4222B94: initable_init (gdbusconnection.c:1783)
==20513==    by 0x41CF8D5: g_initable_init (ginitable.c:106)
==20513==    by 0x41CFA8D: g_initable_new_valist (ginitable.c:219)
==20513==    by 0x41CF920: g_initable_new (ginitable.c:139)
==20513==    by 0x4223479: g_dbus_connection_new_sync (gdbusconnection.c:2046)

Bug #618650.

gio/gdbusauth.c

index d46f32a..35f100a 100644 (file)
@@ -1278,6 +1278,7 @@ _g_dbus_auth_run_server (GDBusAuth              *auth,
             }
           else if (g_strcmp0 (line, "NEGOTIATE_UNIX_FD") == 0)
             {
+              g_free (line);
               if (offered_capabilities & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING)
                 {
                   negotiated_capabilities |= G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING;