Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 415b925

Browse files
author
Neil Conway
committed
Fix a memory leak in psql: we'd leak a few PGresult handles if
a connectivity error occurred while executing one of the queries for "\d <table>". Not serious, but still worth fixing. Patch from Brendan Jurd.
1 parent 8964b41 commit 415b925

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/psql/describe.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.147 2006/10/09 23:30:33 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.148 2006/11/08 01:22:55 neilc Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -1171,7 +1171,14 @@ describeOneTableDetails(const char *schemaname,
11711171

11721172
result6 = PSQLexec(buf.data, false);
11731173
if (!result6)
1174+
{
1175+
PQclear(result1);
1176+
PQclear(result2);
1177+
PQclear(result3);
1178+
PQclear(result4);
1179+
PQclear(result5);
11741180
goto error_return;
1181+
}
11751182
else
11761183
inherits_count = PQntuples(result6);
11771184

0 commit comments

Comments
 (0)