Return-Path: Subject: Re: [patch] obexd: if path == NULL, don't call dbus_connection_get_object_path_data From: Marcel Holtmann To: "Liu, Raymond" Cc: BlueZ development In-Reply-To: <0463F45F3606F4428ED35AC8C709F92E046C0469@pdsmsx502.ccr.corp.intel.com> References: <3D8E1963-54E4-4974-98B3-6E9095046D30@gmail.com> <0463F45F3606F4428ED35AC8C709F92E046C0469@pdsmsx502.ccr.corp.intel.com> Content-Type: text/plain Date: Wed, 24 Dec 2008 04:41:36 +0100 Message-Id: <1230090097.4954.27.camel@californication> Mime-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Raymond, > Just a minor fix for g_dbus_unregister_interface to avoid calling dbus_connection_get_object_path_data when path is NULL. @@ -494,7 +494,7 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection, struct generic_data *data = NULL; struct interface_data *iface; - if (dbus_connection_get_object_path_data(connection, path, + if (!path || dbus_connection_get_object_path_data(connection, path, (void *) &data) == FALSE) return FALSE; So doing some like this would be better: if (!path) return FALSE; if (dbus_connection ...) return FALSE; You should really start thinking for the error => return paradigm all the time. This makes the code a lot simpler to read. Regards Marcel