@@ -411,17 +411,6 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
411
411
412
412
this -> connection = PQsetdbLogin (host ,port ,options ,NULL ,realname ,user ,passwd );
413
413
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
-
425
414
if (PQstatus (this -> connection )== CONNECTION_BAD )
426
415
{
427
416
ecpg_finish (this );
@@ -433,9 +422,30 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
433
422
user ?"for user " :"" ,user ?user :"" ,
434
423
lineno );
435
424
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 );
436
435
return false;
437
436
}
438
437
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
+
439
449
this -> committed = true;
440
450
this -> autocommit = autocommit ;
441
451