aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/lib/connect.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2001-06-15 09:55:51 +0000
committerMichael Meskes <meskes@postgresql.org>2001-06-15 09:55:51 +0000
commita8261182d231d00adbed717c99355f4e3eb5bd03 (patch)
tree82c3d5a7129ed01de97a447daf085e68de5a6e1f /src/interfaces/ecpg/lib/connect.c
parentf09546fabf5c13c6fac457838c7366171df469fc (diff)
downloadpostgresql-a8261182d231d00adbed717c99355f4e3eb5bd03.tar.gz
postgresql-a8261182d231d00adbed717c99355f4e3eb5bd03.zip
fixed bug in connect.c
Diffstat (limited to 'src/interfaces/ecpg/lib/connect.c')
-rw-r--r--src/interfaces/ecpg/lib/connect.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/interfaces/ecpg/lib/connect.c b/src/interfaces/ecpg/lib/connect.c
index 5dc05ea7402..2618cc37ed8 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 : "<DEFAULT>");
+ 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;