From: Michael Meskes Date: Fri, 15 Jun 2001 09:55:51 +0000 (+0000) Subject: fixed bug in connect.c X-Git-Tag: REL7_2_BETA1~1029 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8261182d231d00adbed717c99355f4e3eb5bd03;p=postgresql fixed bug in connect.c --- 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;