Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b75942

Browse files
committed
I've found a memory leak in libecpg of PostgreSQL 7.0.3.
The leak is caused by the memory allocation insrc/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 theleak.Thorsten Knabe
1 parent3bdadd0 commit6b75942

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)

[8]ページ先頭

©2009-2025 Movatter.jp