summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiep.ha@samsung.com>2015-09-23 09:19:59 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-09-23 09:43:46 +0900
commit6a604f15490832bcec18757db64fa597cbd2c6b4 (patch)
tree2b6f8f4dc82853749c5375337d40ed4aad19ca63
parent43d02ed84af7fa7ba20304fc38e60456b9e7c872 (diff)
eldbus: add dbus_pending NULL check
Summary: When we call dbus_connection_send_with_reply, the dbus_pending can be NULL. In this case, the next call dbus_pending_call_set_notify will cause application crash. We should check if dbus_pending is NULL before calling dbus API. @fix Reviewers: cedric Subscribers: englebass, cedric, seoz Differential Revision: https://phab.enlightenment.org/D3081
-rw-r--r--src/lib/eldbus/eldbus_pending.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/eldbus/eldbus_pending.c b/src/lib/eldbus/eldbus_pending.c
index fa68d030bc..69ea322fc7 100644
--- a/src/lib/eldbus/eldbus_pending.c
+++ b/src/lib/eldbus/eldbus_pending.c
@@ -157,6 +157,13 @@ _eldbus_connection_send(Eldbus_Connection *conn, Eldbus_Message *msg, Eldbus_Mes
157 eldbus_pending_dispatch(pending, error_msg); 157 eldbus_pending_dispatch(pending, error_msg);
158 return NULL; 158 return NULL;
159 } 159 }
160 if (!pending->dbus_pending)
161 {
162 error_msg = eldbus_message_error_new(msg, "org.enlightenment.DBus.Error",
163 "dbus_pending is NULL.");
164 eldbus_pending_dispatch(pending, error_msg);
165 return NULL;
166 }
160 if (dbus_pending_call_set_notify(pending->dbus_pending, cb_pending, pending, NULL)) 167 if (dbus_pending_call_set_notify(pending->dbus_pending, cb_pending, pending, NULL))
161 return pending; 168 return pending;
162 169
@@ -238,7 +245,8 @@ eldbus_pending_dispatch(Eldbus_Pending *pending, Eldbus_Message *msg)
238 245
239 if (msg) eldbus_message_unref(msg); 246 if (msg) eldbus_message_unref(msg);
240 eldbus_message_unref(pending->msg_sent); 247 eldbus_message_unref(pending->msg_sent);
241 dbus_pending_call_unref(pending->dbus_pending); 248 if (pending->dbus_pending)
249 dbus_pending_call_unref(pending->dbus_pending);
242 250
243 pending->cb = NULL; 251 pending->cb = NULL;
244 pending->dbus_pending = NULL; 252 pending->dbus_pending = NULL;