[pygobject] Fix caller-allocates emergency free.
- From: Simon van der Linden <svdlinden src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix caller-allocates emergency free.
- Date: Thu, 12 Aug 2010 09:34:47 +0000 (UTC)
commit e4c4cccb588b258dbcd21702e6cddcfe9ebe4ffc
Author: Simon van der Linden <svdlinden gnome org>
Date: Thu Aug 12 11:09:37 2010 +0200
Fix caller-allocates emergency free.
In the state, args, args[i], arg_infos[i], and arg_type_infos[i] must not be
NULL in order to be able caller-allocates. This patch adds those conditions.
Moreover, the interface info needs to be freed afterwards.
https://bugzilla.gnome.org/show_bug.cgi?id=626684
gi/pygi-invoke.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index e3c6dc9..d8e4b35 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -938,12 +938,17 @@ _free_invocation_state (struct invocation_state *state)
for (i = 0; i < state->n_args; i++) {
/* check for caller-allocated values we need to free */
- if (g_arg_info_is_caller_allocates (state->arg_infos[i])) {
+ if (state->args != NULL
+ && state->args[i] != NULL
+ && state->arg_infos[i] != NULL
+ && state->arg_type_infos[i] != NULL
+ && g_arg_info_is_caller_allocates (state->arg_infos[i])) {
GIBaseInfo *info;
GIInfoType info_type;
info = g_type_info_get_interface (state->arg_type_infos[i]);
g_assert (info != NULL);
+
info_type = g_base_info_get_type (info);
/* caller-allocates applies only to structs right now
@@ -959,6 +964,8 @@ _free_invocation_state (struct invocation_state *state)
g_free (state->args[i]);
}
}
+
+ g_base_info_unref (info);
}
if (state->arg_type_infos[i] != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]