diff --git a/ChangeLog b/ChangeLog index e5c8550f..e4e40170 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-10-08 Daniele Varrazzo + * psycopg/typecast_binary.c: use PQfreemem to free memory allocated by + the libpq. Bug reported by Anton Kovalev. + * dropped PSYCOPG_OWN_QUOTING. * psycopg/connection_int.c: Fixed access to freed memory in diff --git a/psycopg/typecast_binary.c b/psycopg/typecast_binary.c index e2efe13f..6a707eae 100644 --- a/psycopg/typecast_binary.c +++ b/psycopg/typecast_binary.c @@ -41,7 +41,7 @@ chunk_dealloc(chunkObject *self) FORMAT_CODE_PY_SSIZE_T, self->base, self->len ); - free(self->base); + PQfreemem(self->base); self->ob_type->tp_free((PyObject *) self); } @@ -176,8 +176,8 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs) Py_DECREF((PyObject *) chunk); } if (str != NULL) { - /* str's mem was allocated by PQunescapeBytea; must use free: */ - free(str); + /* str's mem was allocated by PQunescapeBytea; must use PQfreemem: */ + PQfreemem(str); } if (buffer != NULL) { /* We allocated buffer with PyMem_Malloc; must use PyMem_Free: */