hermet pushed a commit to branch efl-1.15.

http://git.enlightenment.org/core/efl.git/commit/?id=6a604f15490832bcec18757db64fa597cbd2c6b4

commit 6a604f15490832bcec18757db64fa597cbd2c6b4
Author: Thiep Ha <thiep...@samsung.com>
Date:   Wed Sep 23 09:19:59 2015 +0900

    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
---
 src/lib/eldbus/eldbus_pending.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/lib/eldbus/eldbus_pending.c b/src/lib/eldbus/eldbus_pending.c
index fa68d03..69ea322 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
         eldbus_pending_dispatch(pending, error_msg);
         return NULL;
      }
+   if (!pending->dbus_pending)
+     {
+        error_msg = eldbus_message_error_new(msg, 
"org.enlightenment.DBus.Error",
+                                             "dbus_pending is NULL.");
+        eldbus_pending_dispatch(pending, error_msg);
+        return NULL;
+     }
    if (dbus_pending_call_set_notify(pending->dbus_pending, cb_pending, 
pending, NULL))
      return pending;
 
@@ -238,7 +245,8 @@ eldbus_pending_dispatch(Eldbus_Pending *pending, 
Eldbus_Message *msg)
 
    if (msg) eldbus_message_unref(msg);
    eldbus_message_unref(pending->msg_sent);
-   dbus_pending_call_unref(pending->dbus_pending);
+   if (pending->dbus_pending)
+     dbus_pending_call_unref(pending->dbus_pending);
 
    pending->cb = NULL;
    pending->dbus_pending = NULL;

-- 


Reply via email to