diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-12-28 03:35:28 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2019-01-21 02:00:04 +0000 |
commit | f9b798aca9822b9b09e0b000e6410261bad3730c (patch) | |
tree | f5fdfa8b344b7b2b0cc66466f925f3809756a78c | |
parent | 2a05aa2c4327e4bcdcc9da9c903fe7e0534ee308 (diff) | |
download | psycopg2-f9b798aca9822b9b09e0b000e6410261bad3730c.tar.gz |
Avoid unlikely leaks in case of memory errors in Bytes_Format
-rw-r--r-- | psycopg/bytes_format.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/psycopg/bytes_format.c b/psycopg/bytes_format.c index 767aafa..040db40 100644 --- a/psycopg/bytes_format.c +++ b/psycopg/bytes_format.c @@ -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) |