aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib/execute.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-01-02 22:03:02 +0000
committerBruce Momjian <bruce@momjian.us>2001-01-02 22:03:02 +0000
commit6b75942c72162f11152e8fbe54a27e1f54681d03 (patch)
treec16a51da0330033f5561cb73680140ff5ade64dd /src/interfaces/ecpg/lib/execute.c
parent3bdadd042662fc02775a2b353c2212f15445c0dd (diff)
downloadpostgresql-6b75942c72162f11152e8fbe54a27e1f54681d03.tar.gz
postgresql-6b75942c72162f11152e8fbe54a27e1f54681d03.zip
I've found a memory leak in libecpg of PostgreSQL 7.0.3.
The leak is caused by the memory allocation in src/interfaces/ecpg/lib/execute.c in line 669 which is never freed. Adding a "free(array_query);" after PQexec in line 671 seems to fix the leak. Thorsten Knabe
Diffstat (limited to 'src/interfaces/ecpg/lib/execute.c')
-rw-r--r--src/interfaces/ecpg/lib/execute.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/lib/execute.c b/src/interfaces/ecpg/lib/execute.c
index cd8c29a4570..d80bc852c19 100644
--- a/src/interfaces/ecpg/lib/execute.c
+++ b/src/interfaces/ecpg/lib/execute.c
@@ -341,6 +341,7 @@ ECPGis_type_an_array(int type,const struct statement * stmt,const struct variabl
array_query = (char *) ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt->lineno);
sprintf(array_query, "select typelem from pg_type where oid=%d", type);
query = PQexec(stmt->connection->connection, array_query);
+ free(array_query);
if (PQresultStatus(query) == PGRES_TUPLES_OK)
{
isarray = atol((char *) PQgetvalue(query, 0, 0));
@@ -1005,7 +1006,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
*
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
*
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.15 2000/12/18 11:33:54 meskes Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.16 2001/01/02 22:03:02 momjian Exp $
*/
PGconn *ECPG_internal_get_connection(char *name);