Skip to content

Commit a826118

Browse files
author
Michael Meskes
committed
fixed bug in connect.c
1 parent f09546f commit a826118

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/interfaces/ecpg/lib/connect.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,17 +411,6 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
411411

412412
this->connection = PQsetdbLogin(host, port, options, NULL, realname, user, passwd);
413413

414-
if (host)
415-
free(host);
416-
if (port)
417-
free(port);
418-
if (options)
419-
free(options);
420-
if (realname)
421-
free(realname);
422-
if (dbname)
423-
free(dbname);
424-
425414
if (PQstatus(this->connection) == CONNECTION_BAD)
426415
{
427416
ecpg_finish(this);
@@ -433,9 +422,30 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
433422
user ? "for user " : "", user ? user : "",
434423
lineno);
435424
ECPGraise(lineno, ECPG_CONNECT, realname ? realname : "<DEFAULT>");
425+
if (host)
426+
free(host);
427+
if (port)
428+
free(port);
429+
if (options)
430+
free(options);
431+
if (realname)
432+
free(realname);
433+
if (dbname)
434+
free(dbname);
436435
return false;
437436
}
438437

438+
if (host)
439+
free(host);
440+
if (port)
441+
free(port);
442+
if (options)
443+
free(options);
444+
if (realname)
445+
free(realname);
446+
if (dbname)
447+
free(dbname);
448+
439449
this->committed = true;
440450
this->autocommit = autocommit;
441451

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy