diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-07-28 05:06:20 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-07-28 05:06:20 +0000 |
commit | 83ac0144fa3041556aa4f3952ebd979e0189a19c (patch) | |
tree | 6ea0926c622f76b3eb8542cad72ffde6aaabc551 /Modules/almodule.c | |
parent | c8e4bed1c5a11b0447feb38d0870af056a71ad2c (diff) | |
download | cpython-git-83ac0144fa3041556aa4f3952ebd979e0189a19c.tar.gz |
Backport code from r65182:
Issue #2620: Overflow checking when allocating or reallocating memory
was not always being done properly in some python types and extension
modules. PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have
all been updated to perform better checks and places in the code that
would previously leak memory on the error path when such an allocation
failed have been fixed.
Diffstat (limited to 'Modules/almodule.c')
-rw-r--r-- | Modules/almodule.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/almodule.c b/Modules/almodule.c index 0a45d2e0c0..e4481cd3c0 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -1633,9 +1633,11 @@ al_QueryValues(PyObject *self, PyObject *args) if (nvals < 0) goto cleanup; if (nvals > setsize) { + ALvalue *old_return_set = return_set; setsize = nvals; PyMem_RESIZE(return_set, ALvalue, setsize); if (return_set == NULL) { + return_set = old_return_set; PyErr_NoMemory(); goto cleanup; } |