mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Fixed memory leak with large objects
Deallocating closed large objects failed to decrement the connection refcount. The fact the lobject is closed doesn't matter for refcount. Issue detected by the always useful scripts/refcounter.py With an extra bit of unrequested whitespace love.
This commit is contained in:
parent
3dad8344c0
commit
8cf30509ad
1
NEWS
1
NEWS
|
@ -17,6 +17,7 @@ What's new in psycopg 2.5.4
|
|||
PostgreSQL but not documented.
|
||||
- Make sure the internal `_psycopg.so` module can be imported stand-alone
|
||||
(to allow modules juggling such as the one described in :ticket:`#201`).
|
||||
- Fixed memory leak with large objects (regression introduced in 2.5.3).
|
||||
|
||||
|
||||
What's new in psycopg 2.5.3
|
||||
|
|
|
@ -333,11 +333,10 @@ lobject_setup(lobjectObject *self, connectionObject *conn,
|
|||
return -1;
|
||||
}
|
||||
|
||||
Py_INCREF((PyObject*)conn);
|
||||
self->conn = conn;
|
||||
self->mark = conn->mark;
|
||||
|
||||
Py_INCREF((PyObject*)self->conn);
|
||||
|
||||
self->fd = -1;
|
||||
self->oid = InvalidOid;
|
||||
|
||||
|
@ -358,8 +357,8 @@ lobject_dealloc(PyObject* obj)
|
|||
if (self->conn && self->fd != -1) {
|
||||
if (lobject_close(self) < 0)
|
||||
PyErr_Print();
|
||||
Py_XDECREF((PyObject*)self->conn);
|
||||
}
|
||||
Py_CLEAR(self->conn);
|
||||
PyMem_Free(self->smode);
|
||||
|
||||
Dprintf("lobject_dealloc: deleted lobject object at %p, refcnt = "
|
||||
|
|
Loading…
Reference in New Issue
Block a user