[gjs] object: check the interface info before freeing it



commit af3a581181dcd5df24313e528518b5716eb55827
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Feb 3 18:41:01 2014 +0100

    object: check the interface info before freeing it
    
    As the comment says, there may not be any interface info,
    but g_base_info_unref() crashes if passed NULL.

 gi/object.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 9d0afd1..5e74f63 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2297,12 +2297,14 @@ gjs_hook_up_vfunc(JSContext *cx,
 
             /* The interface doesn't have to exist -- it could be private
              * or dynamic. */
-            if (interface)
+            if (interface) {
                 vfunc = g_interface_info_find_vfunc(interface, name);
 
-            g_base_info_unref((GIBaseInfo*)interface);
-            if (vfunc)
-                break;
+                g_base_info_unref((GIBaseInfo*)interface);
+
+                if (vfunc)
+                    break;
+            }
         }
 
         g_free(interface_list);


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