GDBusMethodInvocation: leak and potential crash
authorPatrick Ohly <patrick.ohly@intel.com>
Thu, 7 Mar 2013 17:44:44 +0000 (18:44 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 18 Mar 2013 02:46:20 +0000 (22:46 -0400)
commita8811fb86477d162379694eb8a4480a11ee8cc71
tree02c75b27c07217b3a14d636671d5f52c537dd211
parent1a9567139d56d648eb1fa7b07a660488b6b50435
GDBusMethodInvocation: leak and potential crash

_g_dbus_method_invocation_new is said to allow method_info == NULL,
but will crash inside g_dbus_method_info_ref when the method_info
really is NULL, because g_dbus_method_info_ref does not allow NULL as
parameter. Fixed by checking for NULL in _g_dbus_method_invocation_new
itself.

The leak itself happens because _g_dbus_method_invocation_new stores a
new reference to the method_info without also unreferencing it. Fixed
by adding the missing unref, protected by an if because the pointer
may be NULL.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=695376
gio/gdbusmethodinvocation.c