mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #13019: Fix potential reference leaks in bytearray.extend().
Patch by Suman Saha.
This commit is contained in:
commit
29b964d0dd
2 changed files with 9 additions and 2 deletions
|
@ -10,6 +10,9 @@ What's New in Python 3.3.0 Alpha 2?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #13019: Fix potential reference leaks in bytearray.extend(). Patch
|
||||||
|
by Suman Saha.
|
||||||
|
|
||||||
- Issue #1683368: object.__new__ and object.__init__ raise a TypeError if they
|
- Issue #1683368: object.__new__ and object.__init__ raise a TypeError if they
|
||||||
are passed arguments and their complementary method is not overridden.
|
are passed arguments and their complementary method is not overridden.
|
||||||
|
|
||||||
|
|
|
@ -2289,8 +2289,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
|
bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size);
|
||||||
if (bytearray_obj == NULL)
|
if (bytearray_obj == NULL) {
|
||||||
|
Py_DECREF(it);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
buf = PyByteArray_AS_STRING(bytearray_obj);
|
buf = PyByteArray_AS_STRING(bytearray_obj);
|
||||||
|
|
||||||
while ((item = PyIter_Next(it)) != NULL) {
|
while ((item = PyIter_Next(it)) != NULL) {
|
||||||
|
@ -2323,8 +2325,10 @@ bytearray_extend(PyByteArrayObject *self, PyObject *arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1)
|
if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) {
|
||||||
|
Py_DECREF(bytearray_obj);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
Py_DECREF(bytearray_obj);
|
Py_DECREF(bytearray_obj);
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue