Skip to content

Commit f13e3bd

Browse files
Commit
1 parent a4709e5 commit f13e3bd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix memory leak in :func:`array.array` when creating arrays from empty
2+
:class:`str`.

Modules/arraymodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,6 +2833,9 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
28332833
Py_SET_SIZE(self, n);
28342834
self->allocated = n;
28352835
}
2836+
else {
2837+
PyMem_Free(ustr);
2838+
}
28362839
}
28372840
else { // c == 'w'
28382841
Py_ssize_t n = PyUnicode_GET_LENGTH(initial);

0 commit comments

Comments
 (0)