mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-140474: Fix memory leak in array.array (GH-140478) (GH-140498)
gh-140474: Fix memory leak in `array.array` (GH-140478)
(cherry picked from commit aa9d0a61d5)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
This commit is contained in:
parent
853e5d94eb
commit
0fdae5f590
3 changed files with 13 additions and 0 deletions
|
|
@ -2838,6 +2838,9 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
Py_SET_SIZE(self, n);
|
||||
self->allocated = n;
|
||||
}
|
||||
else {
|
||||
PyMem_Free(ustr);
|
||||
}
|
||||
}
|
||||
else { // c == 'w'
|
||||
Py_ssize_t n = PyUnicode_GET_LENGTH(initial);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue