diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-02-24 10:50:49 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-02-24 22:25:56 +0000 |
commit | 4ecfd48671b3caab869b72f95ba7c686321af6f1 (patch) | |
tree | e2683c2c3b9ef617a52b18b9d16de455fb87631d /psycopg/connection_int.c | |
parent | a6df55f4e31a1a48886615098a21ccbf20782d76 (diff) | |
download | psycopg2-4ecfd48671b3caab869b72f95ba7c686321af6f1.tar.gz |
Fixed possible NULL dereferencing in notice process
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r-- | psycopg/connection_int.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index 7046513..cb65224 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -120,8 +120,16 @@ conn_notice_process(connectionObject *self) /* Respect the order in which notices were produced, because in notice_list they are reversed (see ticket #9) */ - PyList_Insert(self->notice_list, nnotices, msg); - Py_DECREF(msg); + if (msg) { + PyList_Insert(self->notice_list, nnotices, msg); + Py_DECREF(msg); + } + else { + /* We don't really have a way to report errors, so gulp it. + * The function should only fail for out of memory, so we are + * likely going to die anyway. */ + PyErr_Clear(); + } notice = notice->next; } |