Signed-off-by: Holger Hans Peter Freyther <ze...@selfish.org>
---
 ChangeLog     |    6 +++---
 libgst/cint.c |   27 ++++++++++++---------------
 2 files changed, 15 insertions(+), 18 deletions(-)


diff --git a/ChangeLog b/ChangeLog
index 470a1a6..923d700 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,10 @@
 2011-02-05  Holger Hans Peter Freyther  <hol...@freyther.de>
 
-	* tests/local.at: Ignore stderr for package tests.
+	* libgst/cint.c: Propagate type conversion failures.
 
-2011-02-04  Holger Hans Peter Freyther  <hol...@freyther.de>
+2011-02-05  Holger Hans Peter Freyther  <hol...@freyther.de>
 
-	* libgst/cint.c: Propagate type conversion failures.
+	* tests/local.at: Ignore stderr for package tests.
 
 2011-02-04  Holger Hans Peter Freyther  <hol...@freyther.de>
 
diff --git a/libgst/cint.c b/libgst/cint.c
index d16b153..b1519f5 100644
--- a/libgst/cint.c
+++ b/libgst/cint.c
@@ -863,8 +863,18 @@ _gst_invoke_croutine (OOP cFuncOOP,
 	/* Do nothing if it is a void */
 	res = push_smalltalk_obj (args[si++], cType);
 
-      if (res != 0)
-	goto cleanup;
+      /* Cleanup everything we have allocated and exit. */
+      if (UNCOMMON(res != 0))
+	{
+	  for (i = 0; i < c_func_cur->arg_idx; i++)
+	    {
+	      if (local_arg_vec[i].oop)
+		xfree (local_arg_vec[i].u.ptrVal);
+	    }
+
+	  INC_RESTORE_POINTER (incPtr);
+	  return NULL;
+	}
     }
 
   /* If the previous call was done through the same function descriptor,
@@ -923,19 +933,6 @@ _gst_invoke_croutine (OOP cFuncOOP,
 
   INC_RESTORE_POINTER (incPtr);
   return (oop);
-
-cleanup:
-  /* Attempt to cleanup all pushing of arguments. We have tried to
-     write at si and now need to cleanup up until this point. */
-  for (i = 0, arg = local_arg_vec; i < si; i++, arg++)
-    {
-      if (!arg->oop)
-	continue;
-
-      xfree (arg->u.ptrVal);
-    }
-  INC_RESTORE_POINTER (incPtr);
-  return NULL;
 }
 
 ffi_type *

_______________________________________________
help-smalltalk mailing list
help-smalltalk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to