mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 21:00:33 +03:00
Avoid unlikely leaks in case of memory errors in Bytes_Format
This commit is contained in:
parent
2a05aa2c43
commit
f9b798aca9
|
@ -244,10 +244,14 @@ Bytes_Format(PyObject *format, PyObject *args)
|
||||||
if (reslen < 0) {
|
if (reslen < 0) {
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
Py_XDECREF(temp);
|
Py_XDECREF(temp);
|
||||||
|
if (args_owned)
|
||||||
|
Py_DECREF(args);
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
if (_Bytes_Resize(&result, reslen)) {
|
if (_Bytes_Resize(&result, reslen)) {
|
||||||
Py_XDECREF(temp);
|
Py_XDECREF(temp);
|
||||||
|
if (args_owned)
|
||||||
|
Py_DECREF(args);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
res = Bytes_AS_STRING(result)
|
res = Bytes_AS_STRING(result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user