GNOME Bugzilla – Bug 780924
Memory leak in gdbusmethodinvocation.c
Last modified: 2017-04-05 12:13:01 UTC
Created attachment 349289 [details] simplistic gdbus-based server exhibiting the leak gdbus-based servers leak GDBusPropertyInfo instances when handling calls. How to reproduce: 1. Build attached gdbus-based server gcc -g $(pkg-config --cflags gio-2.0 gio-unix-2.0) -o g_dbus_property_info_memory_leak g_dbus_property_info_memory_leak.c $(pkg-config --libs gio-2.0 gio-unix-2.0) 2. Run under valgrind valgrind --show-leak-kinds=definite --leak-check=full ./g_dbus_property_info_memory_leak 3. Invoke a method call gdbus call --session --dest org.myorg.MyObject --object-path /org/myorg/MyObject --method org.freedesktop.DBus.Properties.Get org.myorg.MyObject MyProperty (This will fail since the server is simplistic and just returns Not Supported for all calls, but it doesn't affect the experiment) 4. Stop the server with Ctrl-C and note leak: ==15754== 181 (40 direct, 141 indirect) bytes in 1 blocks are definitely lost in loss record 1,026 of 1,079 ==15754== at 0x4C2EB45: calloc (vg_replace_malloc.c:711) ==15754== by 0x522BF90: g_malloc0 (gmem.c:124) ==15754== by 0x4F0FF3F: parse_data_get_property (gdbusintrospection.c:1158) ==15754== by 0x4F0FF3F: parser_start_element (gdbusintrospection.c:1444) ==15754== by 0x5229DA2: emit_start_element (gmarkup.c:1041) ==15754== by 0x522AE8A: g_markup_parse_context_parse (gmarkup.c:1388) ==15754== by 0x4F10CC6: g_dbus_node_info_new_for_xml (gdbusintrospection.c:1802) ==15754== by 0x108D49: main (example.c:72)
Created attachment 349290 [details] [review] Proposed memory leak fix
Review of attachment 349290 [details] [review]: Looks good, thanks.