[gjs] context: Fix leaks
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] context: Fix leaks
- Date: Tue, 14 Jan 2014 23:48:36 +0000 (UTC)
commit 8d211cc171a7e9260da7848f4aa8144cb15ffc12
Author: Sam Spilsbury <smspillaz gmail com>
Date: Thu Dec 26 08:41:05 2013 -0800
context: Fix leaks
https://bugzilla.gnome.org/show_bug.cgi?id=721246
gjs/console.cpp | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gjs/console.cpp b/gjs/console.cpp
index e3a06c7..d96bd45 100644
--- a/gjs/console.cpp
+++ b/gjs/console.cpp
@@ -115,19 +115,23 @@ main(int argc, char **argv)
if (!gjs_context_define_string_array(js_context, "ARGV",
argc - 1, (const char**)argv + 1,
&error)) {
+ code = 1;
g_printerr("Failed to defined ARGV: %s", error->message);
- exit(1);
+ g_clear_error(&error);
+ goto out;
}
/* evaluate the script */
- error = NULL;
if (!gjs_context_eval(js_context, script, len,
filename, &code, &error)) {
- g_free(script);
+ code = 1;
g_printerr("%s\n", error->message);
- exit(1);
+ g_clear_error(&error);
+ goto out;
}
+ out:
+ g_object_unref(js_context);
g_free(script);
exit(code);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]