From af1478feb9200214d3f4a8ae442f11c87664d00d Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Wed, 19 Mar 2008 01:01:26 +0000 Subject: [PATCH] * psycopg/connection_int.c (conn_notice_callback): don't leak notice messages. --- ChangeLog | 5 +++++ psycopg/connection_int.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 421e9e6f..37294ddb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-19 James Henstridge + + * psycopg/connection_int.c (conn_notice_callback): don't leak + notice messages. + 2008-03-17 Federico Di Gregorio * psycopg/adapter_datetime.c: fixed double decref when using diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index aef2ec31..33df14af 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -46,7 +46,10 @@ conn_notice_callback(void *args, const char *message) if (self->protocol < 3 && strncmp(message, "ERROR", 5) == 0) pq_set_critical(self, message); else { - PyList_Append(self->notice_list, PyString_FromString(message)); + PyObject *msg = PyString_FromString(message); + + PyList_Append(self->notice_list, msg); + Py_DECREF(msg); /* Remove the oldest item if the queue is getting too long. */ if (PyList_GET_SIZE(self->notice_list) > CONN_NOTICES_LIMIT)