Skip to content

Commit 6b75942

Browse files
committed
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
1 parent 3bdadd0 commit 6b75942

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/interfaces/ecpg/lib/execute.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ ECPGis_type_an_array(int type,const struct statement * stmt,const struct variabl
341341
array_query = (char *) ecpg_alloc(strlen("select typelem from pg_type where oid=") + 11, stmt->lineno);
342342
sprintf(array_query, "select typelem from pg_type where oid=%d", type);
343343
query = PQexec(stmt->connection->connection, array_query);
344+
free(array_query);
344345
if (PQresultStatus(query) == PGRES_TUPLES_OK)
345346
{
346347
isarray = atol((char *) PQgetvalue(query, 0, 0));
@@ -1005,7 +1006,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
10051006
*
10061007
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
10071008
*
1008-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.15 2000/12/18 11:33:54 meskes Exp $
1009+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.16 2001/01/02 22:03:02 momjian Exp $
10091010
*/
10101011

10111012
PGconn *ECPG_internal_get_connection(char *name);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy