mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-11 03:26:37 +03:00
Use PQfreemem to free memory allocated by the libpq.
Bug reported by Anton Kovalev.
This commit is contained in:
parent
6e71b3db05
commit
7e482756c5
|
@ -1,5 +1,8 @@
|
||||||
2010-10-08 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
2010-10-08 Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||||
|
|
||||||
|
* psycopg/typecast_binary.c: use PQfreemem to free memory allocated by
|
||||||
|
the libpq. Bug reported by Anton Kovalev.
|
||||||
|
|
||||||
* dropped PSYCOPG_OWN_QUOTING.
|
* dropped PSYCOPG_OWN_QUOTING.
|
||||||
|
|
||||||
* psycopg/connection_int.c: Fixed access to freed memory in
|
* psycopg/connection_int.c: Fixed access to freed memory in
|
||||||
|
|
|
@ -41,7 +41,7 @@ chunk_dealloc(chunkObject *self)
|
||||||
FORMAT_CODE_PY_SSIZE_T,
|
FORMAT_CODE_PY_SSIZE_T,
|
||||||
self->base, self->len
|
self->base, self->len
|
||||||
);
|
);
|
||||||
free(self->base);
|
PQfreemem(self->base);
|
||||||
self->ob_type->tp_free((PyObject *) self);
|
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);
|
Py_DECREF((PyObject *) chunk);
|
||||||
}
|
}
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
/* str's mem was allocated by PQunescapeBytea; must use free: */
|
/* str's mem was allocated by PQunescapeBytea; must use PQfreemem: */
|
||||||
free(str);
|
PQfreemem(str);
|
||||||
}
|
}
|
||||||
if (buffer != NULL) {
|
if (buffer != NULL) {
|
||||||
/* We allocated buffer with PyMem_Malloc; must use PyMem_Free: */
|
/* We allocated buffer with PyMem_Malloc; must use PyMem_Free: */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user