[gjs] function: Fix a memory leak and simplify code
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] function: Fix a memory leak and simplify code
- Date: Tue, 25 Jun 2013 19:40:15 +0000 (UTC)
commit e5abda7503a82163f61f81d5f3f1f5591e0a2475
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Jun 24 20:43:07 2013 -0400
function: Fix a memory leak and simplify code
https://bugzilla.gnome.org/show_bug.cgi?id=703068
gi/function.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index b23c894..9dbef7c 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -1629,9 +1629,7 @@ gjs_define_function(JSContext *context,
function = function_new(context, gtype, info);
if (function == NULL) {
gjs_move_exception(context, context);
-
- JS_EndRequest(context);
- return NULL;
+ goto out;
}
if (info_type == GI_INFO_TYPE_FUNCTION) {
@@ -1649,14 +1647,13 @@ gjs_define_function(JSContext *context,
NULL, NULL,
GJS_MODULE_PROP_FLAGS)) {
gjs_debug(GJS_DEBUG_GFUNCTION, "Failed to define function");
-
- JS_EndRequest(context);
- return NULL;
+ function = NULL;
}
if (free_name)
g_free(name);
+ out:
JS_EndRequest(context);
return function;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]