Fix a memory leak in psql: we'd leak a few PGresult handles if
authorNeil Conway
Wed, 8 Nov 2006 01:22:55 +0000 (01:22 +0000)
committerNeil Conway
Wed, 8 Nov 2006 01:22:55 +0000 (01:22 +0000)
a connectivity error occurred while executing one of the queries
for "\d ". Not serious, but still worth fixing. Patch from
Brendan Jurd.

src/bin/psql/describe.c

index bab0e24f957912a73dc653329502b5eaab599c71..2e526d44107fd93a9883247aa72874655b120d71 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2006, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.147 2006/10/09 23:30:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.148 2006/11/08 01:22:55 neilc Exp $
  */
 #include "postgres_fe.h"
 #include "describe.h"
@@ -1171,7 +1171,14 @@ describeOneTableDetails(const char *schemaname,
 
        result6 = PSQLexec(buf.data, false);
        if (!result6)
+       {
+           PQclear(result1);
+           PQclear(result2);
+           PQclear(result3);
+           PQclear(result4);
+           PQclear(result5);
            goto error_return;
+       }
        else
            inherits_count = PQntuples(result6);