Message71870
When PyArg_ParseTuple correctly parses a s* format, but raises an
exception afterwards (for a subsequent parameter), the user code will
not call PyBuffer_Release() and memory will leak.
Seen by "regrtest -R:: test_binascii"
For example:
>>> binascii.a2b_qp("", **{1:1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: keywords must be strings
[42278 refs]
>>> binascii.a2b_qp("", **{1:1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: keywords must be strings
[42279 refs]
>>> binascii.a2b_qp("", **{1:1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: keywords must be strings
[42280 refs]
The same pattern was correctly handled by the "et#" type (where the user
has to call PyMem_Free) with the help of a cleanup list (see the
addcleanup() function in getargs.c). (See issue501716) |
|
Date |
User |
Action |
Args |
2008-08-24 21:02:58 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc |
2008-08-24 21:02:58 | amaury.forgeotdarc | set | messageid: <1219611778.13.0.51285980437.issue3668@psf.upfronthosting.co.za> |
2008-08-24 21:02:57 | amaury.forgeotdarc | link | issue3668 messages |
2008-08-24 21:02:57 | amaury.forgeotdarc | create | |
|