From 1b9f774090d58a950ef0535b51bc377ab62b795c Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Mon, 16 Jan 2012 20:08:33 +0200
Subject: [PATCH] psql: Fix memory leak

The command

\password username

leaked memory.
---
 src/bin/psql/command.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 69fac83cd58..6c3f0aa69d6 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -953,6 +953,9 @@ exec_command(const char *cmd,
 					PQclear(res);
 				PQfreemem(encrypted_password);
 			}
+
+			if (opt0)
+				free(opt0);
 		}
 
 		free(pw1);
-- 
GitLab