From 607319331410a21111965727ebea9ac1d9dd8f23 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Mon, 19 May 2008 10:14:17 +0200 Subject: [PATCH] Fixed memory leak in executemany --- ChangeLog | 5 +++++ psycopg/cursor_type.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 32f4763c..5367d35f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-19 Federico Di Gregorio + + * psycopg/cursor_type.c: fixed memory leak in .executemany(); on + error "iter" was not dec'reffed. + 2008-05-06 James Henstridge * psycopg/lobject.h (lobjectObject): remove "mode" struct member, diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index a17847ea..5b0cd026 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -521,6 +521,7 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs) while ((v = PyIter_Next(vars)) != NULL) { if (_psyco_curs_execute(self, operation, v, 0) == 0) { Py_DECREF(v); + Py_XDECREF(iter); return NULL; } else {