From 59053718becde5238088a1d25cc2a6de8de2979f Mon Sep 17 00:00:00 2001 From: Anthony Tuininga Date: Thu, 12 Jan 2017 14:09:27 -0700 Subject: [PATCH] Remove memory leak when function call raises an exception. --- Cursor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Cursor.c b/Cursor.c index c2f6fe8..198341d 100644 --- a/Cursor.c +++ b/Cursor.c @@ -1596,8 +1596,10 @@ static PyObject *Cursor_CallFunc( return NULL; // call the function - if (Cursor_Call(self, var, name, listOfArguments, keywordArguments) < 0) + if (Cursor_Call(self, var, name, listOfArguments, keywordArguments) < 0) { + Py_DECREF(var); return NULL; + } // determine the results results = Variable_GetValue(var, 0);