[gjs] function: Add a missing break; , close memory leak for inout arrays
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] function: Add a missing break; , close memory leak for inout arrays
- Date: Fri, 17 Jun 2011 18:14:15 +0000 (UTC)
commit 6c111e16fbaadaa43eae0b38f0b1c5dd73b9abb6
Author: Colin Walters <walters verbum org>
Date: Fri Jun 17 14:05:58 2011 -0400
function: Add a missing break;, close memory leak for inout arrays
The transfer change for INOUT arguments was wrong; we don't want it to
be EVERYTHING since then the release code assumes that the C function
took ownership. Make it NOTHING to "trick" the release into releasing
our temporary.
gi/function.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index a8b0d26..9b02d00 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -577,6 +577,7 @@ gjs_invoke_c_function(JSContext *context,
failed = TRUE;
break;
}
+ /* Also handle the INOUT for the length here */
if (direction == GI_DIRECTION_INOUT) {
if (in_value->v_pointer == NULL) {
/* Special case where we were given JS null to
@@ -591,6 +592,7 @@ gjs_invoke_c_function(JSContext *context,
in_arg_cvalues[array_length_pos].v_pointer = &out_arg_cvalues[array_length_pos];
}
}
+ break;
}
case PARAM_NORMAL:
/* Ok, now just convert argument normally */
@@ -746,7 +748,7 @@ release:
* the temporary C value we allocated, clearly we're responsible for
* freeing it.
*/
- transfer = GI_TRANSFER_EVERYTHING;
+ transfer = GI_TRANSFER_NOTHING;
}
if (param_type == PARAM_CALLBACK) {
ffi_closure *closure = arg->v_pointer;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]