[pygobject] closure: avoid double free crash



commit 1491f6225b9906bd369b5a42e6369ab6884736b7
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jun 10 14:01:32 2011 +0200

    closure: avoid double free crash

 gi/pygi-closure.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index 1ec6c66..35281a2 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -253,12 +253,9 @@ _pygi_closure_convert_arguments (GICallableInfo *callable_info, void **args,
 
 error:
     Py_CLEAR (*py_args);
-
-    if (*out_args != NULL)
-        g_free (*out_args);
-
-    if (g_args != NULL)
-        g_free (g_args);
+    g_free (*out_args);
+    *out_args = NULL;
+    g_free (g_args);
 
     return FALSE;
 }
@@ -367,8 +364,7 @@ _pygi_closure_handle (ffi_cif *cif,
     _pygi_closure_set_out_arguments (closure->info, retval, out_args, result);
 
 end:
-    if (out_args != NULL)
-        g_free (out_args);
+    g_free (out_args);
     g_base_info_unref ( (GIBaseInfo*) return_type);
 
     PyGILState_Release (state);



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