[perl-Glib-Object-Introspection] Fix a leak in struct_to_sv



commit 9a64082c5f4d1102427a5aa950d35a4cae2c128f
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Mon Apr 26 23:53:10 2010 +0200

    Fix a leak in struct_to_sv

 GObjectIntrospection.xs |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index af81087..3c8ed92 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -418,22 +418,25 @@ struct_to_sv (GIBaseInfo* info,
 			g_struct_info_get_n_fields ((GIStructInfo *) info);
 		for (i = 0; i < n_fields; i++) {
 			GIFieldInfo *field_info;
+			GITypeInfo *field_type;
 			GArgument value;
 			field_info =
 				g_struct_info_get_field ((GIStructInfo *) info, i);
+			field_type = g_field_info_get_type (field_info);
+			/* FIXME: Check GIFieldInfoFlags. */
 			if (g_field_info_get_field (field_info, pointer, &value)) {
 				/* FIXME: Is it right to use
 				 * GI_TRANSFER_NOTHING here? */
 				SV *sv;
 				const gchar *name;
-				sv = arg_to_sv (
-				       &value,
-				       g_field_info_get_type (field_info),
-				       GI_TRANSFER_NOTHING);
+				sv = arg_to_sv (&value,
+				                field_type,
+				                GI_TRANSFER_NOTHING);
 				name = g_base_info_get_name (
 				         (GIBaseInfo *) field_info);
 				gperl_hv_take_sv (hv, name, strlen (name), sv);
 			}
+			g_base_info_unref ((GIBaseInfo *) field_type);
 			g_base_info_unref ((GIBaseInfo *) field_info);
 		}
 		break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]