summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2014-02-03 18:41:01 +0100
committerGiovanni Campagna <gcampagna@src.gnome.org>2014-06-25 20:54:49 +0200
commitaf3a581181dcd5df24313e528518b5716eb55827 (patch)
tree8fd7f5340b4eb456f68085a063f80f514175c81f
parentdedc335d71f4fb33cc67c920cb60b0c6f08381c1 (diff)
downloadgjs-af3a581181dcd5df24313e528518b5716eb55827.tar.gz
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.
-rw-r--r--gi/object.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/gi/object.cpp b/gi/object.cpp
index 9d0afd16..5e74f638 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);