[gjs] repo: Fix memory leak
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] repo: Fix memory leak
- Date: Wed, 5 Oct 2011 20:47:18 +0000 (UTC)
commit 8ba8bb34a37246a4cd813e09830135fea6ab0290
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Oct 5 16:31:28 2011 -0400
repo: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=654069
gi/repo.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/gi/repo.c b/gi/repo.c
index 88d6a24..6a92f08 100644
--- a/gi/repo.c
+++ b/gi/repo.c
@@ -369,26 +369,26 @@ gjs_define_constant(JSContext *context,
GArgument garg = { 0, };
GITypeInfo *type_info;
const char *name;
+ JSBool ret = JS_FALSE;
type_info = g_constant_info_get_type(info);
g_constant_info_get_value(info, &garg);
- if (!gjs_value_from_g_argument(context, &value, type_info, &garg)) {
- g_base_info_unref((GIBaseInfo*) type_info);
- return JS_FALSE;
- }
-
- g_base_info_unref((GIBaseInfo*) type_info);
+ if (!gjs_value_from_g_argument(context, &value, type_info, &garg))
+ goto out;
name = g_base_info_get_name((GIBaseInfo*) info);
- if (!JS_DefineProperty(context, in_object,
- name, value,
- NULL, NULL,
- GJS_MODULE_PROP_FLAGS))
- return JS_FALSE;
+ if (JS_DefineProperty(context, in_object,
+ name, value,
+ NULL, NULL,
+ GJS_MODULE_PROP_FLAGS))
+ ret = JS_TRUE;
- return JS_TRUE;
+ out:
+ g_constant_info_free_value (info, &garg);
+ g_base_info_unref((GIBaseInfo*) type_info);
+ return ret;
}
#if GJS_VERBOSE_ENABLE_GI_USAGE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]