diff options
author | Fred Drake <fdrake@acm.org> | 1998-12-18 19:46:59 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1998-12-18 19:46:59 (GMT) |
commit | 6de7d0c3388f93288449449cc2a711358ffc4529 (patch) | |
tree | 375c1d669c91480ecd384818395bfb084456d8bd | |
parent | 654387efbd9ba363a1911e493a8477f15608e1a0 (diff) | |
download | cpython-6de7d0c3388f93288449449cc2a711358ffc4529.zip cpython-6de7d0c3388f93288449449cc2a711358ffc4529.tar.gz cpython-6de7d0c3388f93288449449cc2a711358ffc4529.tar.bz2 |
When _PyString_Resize() reports failure, the variable referring to the
string we wanted to resize is set to NULL. Don't Py_DECREF() those
variables! (5 places)
-rw-r--r-- | Modules/zlibmodule.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 3e4e23d..9cfcbb7 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -224,7 +224,6 @@ PyZlib_decompress(self, args) PyErr_SetString(PyExc_MemoryError, "Out of memory while decompressing data"); inflateEnd(&zst); - Py_DECREF(result_str); return NULL; } zst.next_out = (unsigned char *)PyString_AsString(result_str) + r_strlen; @@ -407,7 +406,6 @@ PyZlib_objcompress(self, args) if (_PyString_Resize(&RetVal, length << 1) == -1) { PyErr_SetString(PyExc_MemoryError, "Can't allocate memory to compress data"); - Py_DECREF(RetVal); return NULL; } self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length; @@ -466,7 +464,6 @@ PyZlib_objdecompress(self, args) { PyErr_SetString(PyExc_MemoryError, "Can't allocate memory to compress data"); - Py_DECREF(RetVal); return NULL; } self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length; @@ -521,7 +518,6 @@ PyZlib_flush(self, args) if (_PyString_Resize(&RetVal, length << 1) == -1) { PyErr_SetString(PyExc_MemoryError, "Can't allocate memory to compress data"); - Py_DECREF(RetVal); return NULL; } self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length; @@ -591,7 +587,6 @@ PyZlib_unflush(self, args) { PyErr_SetString(PyExc_MemoryError, "Can't allocate memory to decompress data"); - Py_DECREF(RetVal); return NULL; } self->zst.next_out = (unsigned char *)PyString_AsString(RetVal) + length; |