summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--psycopg/connection_int.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 421e9e6..37294dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-19 James Henstridge <james@jamesh.id.au>
+
+ * psycopg/connection_int.c (conn_notice_callback): don't leak
+ notice messages.
+
2008-03-17 Federico Di Gregorio <fog@initd.org>
* psycopg/adapter_datetime.c: fixed double decref when using
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index aef2ec3..33df14a 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)