Kaydet (Commit) 313bda12 authored tarafından Amaury Forgeot d'Arc's avatar Amaury Forgeot d'Arc

Fix a refleak in bytearray.split and bytearray.rsplit, detected by

   regrtest.py -R:: test_bytes
üst 37553fdb
......@@ -2295,8 +2295,11 @@ bytes_split(PyByteArrayObject *self, PyObject *args)
PyBuffer_Release(&vsub);
return NULL;
}
if (n == 1)
return split_char(s, len, sub[0], maxsplit);
if (n == 1) {
list = split_char(s, len, sub[0], maxsplit);
PyBuffer_Release(&vsub);
return list;
}
list = PyList_New(PREALLOC_SIZE(maxsplit));
if (list == NULL) {
......@@ -2527,8 +2530,11 @@ bytes_rsplit(PyByteArrayObject *self, PyObject *args)
PyBuffer_Release(&vsub);
return NULL;
}
else if (n == 1)
return rsplit_char(s, len, sub[0], maxsplit);
else if (n == 1) {
list = rsplit_char(s, len, sub[0], maxsplit);
PyBuffer_Release(&vsub);
return list;
}
list = PyList_New(PREALLOC_SIZE(maxsplit));
if (list == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment