[gjs] Bug 585460: Fix segfault when a non-existing node is introspected.



commit 44ce3c883206c149eabced7920023ec752780c71
Author: C. Scott Ananian <cscott litl com>
Date:   Thu Jun 11 13:46:56 2009 -0400

    Bug 585460: Fix segfault when a non-existing node is introspected.

 modules/dbus-exports.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index 1d56a70..9978ccd 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -686,12 +686,12 @@ find_js_property_by_path(JSContext  *context,
 
     g_strfreev(elements);
 
-    if (obj != NULL) {
-        // this is the directory object; see if there's an actual
-        // implementation object hanging off it.
-        if (dir_obj_p)
-            *dir_obj_p = obj;
+    // this is the directory object; see if there's an actual
+    // implementation object hanging off it.
+    if (dir_obj_p)
+        *dir_obj_p = obj;
 
+    if (obj != NULL) {
         gjs_object_get_property(context, obj, "-impl-", &value);
 
         if (value == JSVAL_VOID ||
@@ -1545,10 +1545,11 @@ on_message(DBusConnection *connection,
                   "Default-introspecting JS obj at dbus path %s",
                   path);
 
-        result = handle_introspect(priv->context,
-                                   connection,
-                                   dir_obj, obj,
-                                   message);
+        if (dir_obj != NULL)
+            result = handle_introspect(priv->context,
+                                       connection,
+                                       dir_obj, obj,
+                                       message);
         goto out;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]