Added error check in _mogrify for failed tuple creation

This commit is contained in:
Daniele Varrazzo 2012-02-24 21:44:29 +00:00
parent 0ee641361b
commit efee049338

View File

@ -217,7 +217,10 @@ _mogrify(PyObject *var, PyObject *fmt, cursorObject *curs, PyObject **new)
} }
if (n == NULL) { if (n == NULL) {
n = PyTuple_New(PyObject_Length(var)); if (!(n = PyTuple_New(PyObject_Length(var)))) {
Py_DECREF(value);
return -1;
}
} }
/* let's have d point just after the '%' */ /* let's have d point just after the '%' */