After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 634671 - Correct a bug in the freeing of memory in pygi-invoke.c.
Correct a bug in the freeing of memory in pygi-invoke.c.
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2010-11-12 09:35 UTC by Damien Caliste
Modified: 2010-11-29 20:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Correct a bug in the freeing of memory in pygi-invoke.c. (2.95 KB, patch)
2010-11-12 09:36 UTC, Damien Caliste
committed Details | Review
Add a test to check the ability to free invocation state in case of wrong number of arguments and INOUT (547 bytes, patch)
2010-11-26 09:40 UTC, Damien Caliste
committed Details | Review

Description Damien Caliste 2010-11-12 09:35:56 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.
Comment 1 Damien Caliste 2010-11-12 09:36:01 UTC
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.
Comment 2 johnp 2010-11-12 15:52:26 UTC
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.
Comment 3 Damien Caliste 2010-11-26 09:35:33 UTC
   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.
Comment 4 Damien Caliste 2010-11-26 09:40:41 UTC
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
Comment 5 johnp 2010-11-29 20:19:09 UTC
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.