summaryrefslogtreecommitdiff
path: root/psycopg
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-10-08 14:26:40 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-10-08 14:26:40 +0100
commit7e482756c5e1cd9b75507fd8914b06d68f9eab87 (patch)
treed886c9df1b06c9f57b1a4db1872b752051762631 /psycopg
parent6e71b3db057eb4a18d5ee5c112a2ab50e0a7c5ab (diff)
downloadpsycopg2-7e482756c5e1cd9b75507fd8914b06d68f9eab87.tar.gz
Use PQfreemem to free memory allocated by the libpq.
Bug reported by Anton Kovalev.
Diffstat (limited to 'psycopg')
-rw-r--r--psycopg/typecast_binary.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/psycopg/typecast_binary.c b/psycopg/typecast_binary.c
index e2efe13..6a707ea 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: */