Avoid unlikely leaks in case of memory errors in Bytes_Format

This commit is contained in:
Daniele Varrazzo 2018-12-28 03:35:28 +01:00
parent 2a05aa2c43
commit f9b798aca9

View File

@ -244,10 +244,14 @@ Bytes_Format(PyObject *format, PyObject *args)
if (reslen < 0) {
Py_DECREF(result);
Py_XDECREF(temp);
if (args_owned)
Py_DECREF(args);
return PyErr_NoMemory();
}
if (_Bytes_Resize(&result, reslen)) {
Py_XDECREF(temp);
if (args_owned)
Py_DECREF(args);
return NULL;
}
res = Bytes_AS_STRING(result)