mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Added missing return in case out of memory.
This commit is contained in:
parent
1ed16c8265
commit
c71b7a03d0
|
@ -125,7 +125,7 @@ typecast_DECIMAL_cast(char *s, Py_ssize_t len, PyObject *curs)
|
||||||
if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
|
if (s == NULL) {Py_INCREF(Py_None); return Py_None;}
|
||||||
|
|
||||||
if ((buffer = PyMem_Malloc(len+1)) == NULL)
|
if ((buffer = PyMem_Malloc(len+1)) == NULL)
|
||||||
PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
strncpy(buffer, s, (size_t) len); buffer[len] = '\0';
|
strncpy(buffer, s, (size_t) len); buffer[len] = '\0';
|
||||||
res = PyObject_CallFunction(decimalType, "s", buffer);
|
res = PyObject_CallFunction(decimalType, "s", buffer);
|
||||||
PyMem_Free(buffer);
|
PyMem_Free(buffer);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user