From 9810d508b5d8c27c7e557088c19769170da16292 Mon Sep 17 00:00:00 2001 From: mrmilosz Date: Wed, 28 May 2014 01:27:56 -0400 Subject: [PATCH] cursor.callproc: added a missing memory check --- psycopg/cursor_type.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 68ecb3bd..8506a75b 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1064,6 +1064,13 @@ psyco_curs_callproc(cursorObject *self, PyObject *args) /* we will throw the sanitized C strings into a cache to not redo the work later */ parameter_name_cstr_sanitized_CACHE = PyMem_New(char *, nparameters); + if (parameter_name_cstr_sanitized_CACHE == NULL) { + PyErr_NoMemory(); + PyMem_Del(parameter_name_cstr_sanitized_CACHE); + Py_DECREF(parameter_names); + goto exit; + } + for(i=0; i