From a8261182d231d00adbed717c99355f4e3eb5bd03 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Fri, 15 Jun 2001 09:55:51 +0000 Subject: [PATCH] fixed bug in connect.c --- src/interfaces/ecpg/lib/connect.c | 32 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/interfaces/ecpg/lib/connect.c b/src/interfaces/ecpg/lib/connect.c index 5dc05ea740..2618cc37ed 100644 --- a/src/interfaces/ecpg/lib/connect.c +++ b/src/interfaces/ecpg/lib/connect.c @@ -411,17 +411,6 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd, this->connection = PQsetdbLogin(host, port, options, NULL, realname, user, passwd); - if (host) - free(host); - if (port) - free(port); - if (options) - free(options); - if (realname) - free(realname); - if (dbname) - free(dbname); - if (PQstatus(this->connection) == CONNECTION_BAD) { ecpg_finish(this); @@ -433,9 +422,30 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd, user ? "for user " : "", user ? user : "", lineno); ECPGraise(lineno, ECPG_CONNECT, realname ? realname : ""); + if (host) + free(host); + if (port) + free(port); + if (options) + free(options); + if (realname) + free(realname); + if (dbname) + free(dbname); return false; } + if (host) + free(host); + if (port) + free(port); + if (options) + free(options); + if (realname) + free(realname); + if (dbname) + free(dbname); + this->committed = true; this->autocommit = autocommit; -- 2.40.0