[gjs] value: Fix memory leak while marshalling GValue
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] value: Fix memory leak while marshalling GValue
- Date: Fri, 1 Sep 2017 00:10:38 +0000 (UTC)
commit 61b1d8d2f601486954fa4141e3bde47b68ea106d
Author: Philip Chimento <philip endlessm com>
Date: Wed Aug 30 13:39:39 2017 -0700
value: Fix memory leak while marshalling GValue
g_value_set_boxed() copies the GValue, so if the GValue is holding a
value that must be freed, e.g. a string, it needs to be unset.
(g_value_take_boxed() will not work since the GValue that it would take
ownership of is stack-allocated.)
https://bugzilla.gnome.org/show_bug.cgi?id=786995
gi/value.cpp | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/gi/value.cpp b/gi/value.cpp
index c718828..bf2ed75 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -535,6 +535,7 @@ gjs_value_to_g_value_internal(JSContext *context,
return false;
g_value_set_boxed(gvalue, &nested_gvalue);
+ g_value_unset(&nested_gvalue);
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]