GNOME Bugzilla – Bug 634671
Correct a bug in the freeing of memory in pygi-invoke.c.
Last modified: 2010-11-29 20:19:28 UTC
As said in the commit message, this patch correct an assertion failure in the case of a routine with inout arguments and called with a wrong number of arguments. Indeed, in that case, _prepare_invocation_state() fails at line 236, without allocating state->args. In this situation the for loop of _free_invocation_state() is not entered and the consistency check on backup_args_pos is not incremented. This patch corrects this by entering the loop always and deallocating each element by their allocation status and not only on state->args.
Created attachment 174313 [details] [review] Correct a bug in the freeing of memory in pygi-invoke.c. When a method with inout arguments is called from Python with a wrong number of arguments, the system crashs because of an assertion fail. This patch corrects this behaviour.
Is there a test that was failing? I don't remember seeing any issues in make check which tells me we should have a test for this. Looks good but can you add a test which hits the assert so we don't mess this up if we say, rewrite invoke from scratch? Thanks for the patch. Looks good otherwise.
I finally tried to add a failing test to show my point. I clone a git master of pygobject today and I was suprised to see that the patch has already been applied. Am I right ? In case you would like anyway to add a test, you can add the newly attached patch.
Created attachment 175299 [details] [review] Add a test to check the ability to free invocation state in case of wrong number of arguments and INOUT
Hey, thanks I committed your first patch because I was running through the bugs and it looked right. I usually insist on tests but I rather have things fixed then just sit in bugzilla. Thanks for getting around to adding the test.