From 152d24f5ddbc535bb437b57856fa3c7c5c630472 Mon Sep 17 00:00:00 2001
From: Stephen Frost <sfrost@snowman.net>
Date: Sun, 26 Jan 2014 17:58:48 -0500
Subject: [PATCH] Fix minor leak in pg_dump

Move allocation to after we check the remote server version, to avoid
a possible, very minor, memory leak.  This makes us more consistent
throughout as most places in pg_dump are done in the same way (due, in
part, to previous fixes like this).

Spotted by the Coverity scanner.
---
 src/bin/pg_dump/pg_dump.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 3862f05fb08..ebbb5b730c3 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -3602,7 +3602,7 @@ getConversions(Archive *fout, int *numConversions)
 	PGresult   *res;
 	int			ntups;
 	int			i;
-	PQExpBuffer query = createPQExpBuffer();
+	PQExpBuffer query;
 	ConvInfo   *convinfo;
 	int			i_tableoid;
 	int			i_oid;
@@ -3617,6 +3617,8 @@ getConversions(Archive *fout, int *numConversions)
 		return NULL;
 	}
 
+	query = createPQExpBuffer();
+
 	/*
 	 * find all conversions, including builtin conversions; we filter out
 	 * system-defined conversions at dump-out time.
-- 
GitLab