Skip to contentSkip to conversation

dbus: NULL check proxy on method calls

PATCH Superseded Brian Gix 1 participant 1 message Dec 17, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Brian Gix

author
#0 lore raw

PATCH 1/1 dbus: NULL check proxy on method calls

l_dbus_proxy_method_call() seg-faults when called with a NULL proxy pointer. This NULL check follows the pattern of NULL checks in the other LIB_EXPORT methods in module.

---
 ell/dbus-client.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
ell/dbus-client.c +5 -2
index 541f3e8..f735f33 100644
@@ -301,6 +301,9 @@ LIB_EXPORT uint32_t l_dbus_proxy_method_call(struct l_dbus_proxy *proxy,
 {
 	struct method_call_request *req;
 
+	if (unlikely(!proxy))
+		return 0;
+
 	req = l_new(struct method_call_request, 1);
 	req->proxy = proxy;
 	req->setup = setup;
@@ -648,8 +651,8 @@ LIB_EXPORT void l_dbus_client_destroy(struct l_dbus_client *client)
 		client->proxy_cb_data_destroy(client->proxy_cb_data);
 
 	if (client->objects_call)
-		l_dbus_cancel(client->dbus, client->objects_call)
-;
+		l_dbus_cancel(client->dbus, client->objects_call);
+
 	l_queue_destroy(client->proxies,
 				(l_queue_destroy_func_t)dbus_proxy_destroy);
 
Signature · 1 line
2.21.0