=?utf-8?q?=5Bperl-Glib-Object-Introspection=5D_Plug_a_leak_in_SV_?= =?utf-8?q?=E2=86=92_GArray?=
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Plug a leak in SV â GArray
- Date: Wed, 23 Jan 2013 20:26:43 +0000 (UTC)
commit 565e78c47c0849f6130d25a7837cdc6fee1a3b2a
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Mon Jan 21 00:30:02 2013 +0100
Plug a leak in SV â GArray
gperl-i11n-marshal-array.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gperl-i11n-marshal-array.c b/gperl-i11n-marshal-array.c
index e3dcc38..b95ae33 100644
--- a/gperl-i11n-marshal-array.c
+++ b/gperl-i11n-marshal-array.c
@@ -1,5 +1,12 @@
/* -*- mode: c; indent-tabs-mode: t; c-basic-offset: 8; -*- */
+static void
+free_raw_array (gpointer raw_array)
+{
+ dwarn ("free_raw_array %p\n", raw_array);
+ g_free (raw_array);
+}
+
/* This may call Perl code (via arg_to_sv), so it needs to be wrapped with
* PUTBACK/SPAGAIN by the caller. */
static SV *
@@ -87,6 +94,7 @@ sv_to_array (GITransfer transfer,
gint i, length, length_pos;
GPerlI11nArrayInfo *array_info = NULL;
GArray *array;
+ gpointer raw_array;
gboolean is_zero_terminated = FALSE;
gsize item_size;
gboolean need_struct_value_semantics;
@@ -165,8 +173,11 @@ sv_to_array (GITransfer transfer,
array_info->length = length;
}
+ raw_array = g_array_free (array, FALSE);
+ if (GI_TRANSFER_NOTHING == transfer)
+ free_after_call (iinfo, (GFunc) free_raw_array, raw_array);
+
g_base_info_unref ((GIBaseInfo *) param_info);
- /* FIXME: for transfer=nothing, we seem to be leaking the bare array. */
- return g_array_free (array, FALSE);
+ return raw_array;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]