From f07c7bf4e757b27b5079e40375f2179187e14bc6 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 26 Mar 1998 23:46:14 +0000
Subject: [PATCH] I have been troubled by a segmentation fault when reloading
 from a dumpall.  This has been happening when a second \connect is
 encountered.

The faulty code was in fe-connect.c, where the memory for the user
password was freed, but the pointer itself was not set to NULL.
Later, the memory was reused and the password appeared not to be
empty, so that an attempt was made to reference it.

Oliver Elphick
---
 src/interfaces/libpq/fe-connect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 30f07927c60..8042a043986 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.63 1998/02/26 04:44:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.64 1998/03/26 23:46:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -667,6 +667,7 @@ connectDB(PGconn *conn)
 	if (conn->pgpass != NULL)
 	{
 		free(conn->pgpass);
+		conn->pgpass = NULL;
 	}
 
 	return CONNECTION_OK;
-- 
GitLab