diff options
| author | James Henstridge <james@jamesh.id.au> | 2008-03-19 01:01:26 +0000 |
|---|---|---|
| committer | James Henstridge <james@jamesh.id.au> | 2008-03-19 01:01:26 +0000 |
| commit | af1478feb9200214d3f4a8ae442f11c87664d00d (patch) | |
| tree | 73b48a34bb299027c25fcf59462852306eeffd0a /psycopg/connection_int.c | |
| parent | 8103f44a125fc1207a5db6211ce902b0c70f8541 (diff) | |
| download | psycopg2-af1478feb9200214d3f4a8ae442f11c87664d00d.tar.gz | |
* psycopg/connection_int.c (conn_notice_callback): don't leak
notice messages.
Diffstat (limited to 'psycopg/connection_int.c')
| -rw-r--r-- | psycopg/connection_int.c | 5 |
1 files changed, 4 insertions, 1 deletions
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) |
