@ -2027,13 +2027,11 @@ pqConnectOptions2(PGconn *conn)
if ( len < 0 )
if ( len < 0 )
{
{
libpq_append_conn_error ( conn , " invalid SCRAM client key " ) ;
libpq_append_conn_error ( conn , " invalid SCRAM client key " ) ;
free ( conn - > scram_client_key_binary ) ;
return false ;
return false ;
}
}
if ( len ! = SCRAM_MAX_KEY_LEN )
if ( len ! = SCRAM_MAX_KEY_LEN )
{
{
libpq_append_conn_error ( conn , " invalid SCRAM client key length: %d " , len ) ;
libpq_append_conn_error ( conn , " invalid SCRAM client key length: %d " , len ) ;
free ( conn - > scram_client_key_binary ) ;
return false ;
return false ;
}
}
conn - > scram_client_key_len = len ;
conn - > scram_client_key_len = len ;
@ -2052,13 +2050,11 @@ pqConnectOptions2(PGconn *conn)
if ( len < 0 )
if ( len < 0 )
{
{
libpq_append_conn_error ( conn , " invalid SCRAM server key " ) ;
libpq_append_conn_error ( conn , " invalid SCRAM server key " ) ;
free ( conn - > scram_server_key_binary ) ;
return false ;
return false ;
}
}
if ( len ! = SCRAM_MAX_KEY_LEN )
if ( len ! = SCRAM_MAX_KEY_LEN )
{
{
libpq_append_conn_error ( conn , " invalid SCRAM server key length: %d " , len ) ;
libpq_append_conn_error ( conn , " invalid SCRAM server key length: %d " , len ) ;
free ( conn - > scram_server_key_binary ) ;
return false ;
return false ;
}
}
conn - > scram_server_key_len = len ;
conn - > scram_server_key_len = len ;
@ -5053,21 +5049,19 @@ freePGconn(PGconn *conn)
free ( conn - > events [ i ] . name ) ;
free ( conn - > events [ i ] . name ) ;
}
}
release_conn_addrinfo ( conn ) ;
/* free everything not freed in pqClosePGconn */
pqReleaseConnHosts ( conn ) ;
free ( conn - > client_encoding_initial ) ;
free ( conn - > events ) ;
free ( conn - > pghost ) ;
free ( conn - > pghost ) ;
free ( conn - > pghostaddr ) ;
free ( conn - > pghostaddr ) ;
free ( conn - > pgport ) ;
free ( conn - > pgport ) ;
free ( conn - > connect_timeout ) ;
free ( conn - > connect_timeout ) ;
free ( conn - > pgtcp_user_timeout ) ;
free ( conn - > pgtcp_user_timeout ) ;
free ( conn - > client_encoding_initial ) ;
free ( conn - > pgoptions ) ;
free ( conn - > pgoptions ) ;
free ( conn - > appname ) ;
free ( conn - > appname ) ;
free ( conn - > fbappname ) ;
free ( conn - > fbappname ) ;
free ( conn - > dbName ) ;
free ( conn - > dbName ) ;
free ( conn - > replication ) ;
free ( conn - > replication ) ;
free ( conn - > pgservice ) ;
free ( conn - > pguser ) ;
free ( conn - > pguser ) ;
if ( conn - > pgpass )
if ( conn - > pgpass )
{
{
@ -5082,8 +5076,9 @@ freePGconn(PGconn *conn)
free ( conn - > keepalives_count ) ;
free ( conn - > keepalives_count ) ;
free ( conn - > sslmode ) ;
free ( conn - > sslmode ) ;
free ( conn - > sslnegotiation ) ;
free ( conn - > sslnegotiation ) ;
free ( conn - > sslcert ) ;
free ( conn - > sslcompression ) ;
free ( conn - > sslkey ) ;
free ( conn - > sslkey ) ;
free ( conn - > sslcert ) ;
if ( conn - > sslpassword )
if ( conn - > sslpassword )
{
{
explicit_bzero ( conn - > sslpassword , strlen ( conn - > sslpassword ) ) ;
explicit_bzero ( conn - > sslpassword , strlen ( conn - > sslpassword ) ) ;
@ -5093,32 +5088,40 @@ freePGconn(PGconn *conn)
free ( conn - > sslrootcert ) ;
free ( conn - > sslrootcert ) ;
free ( conn - > sslcrl ) ;
free ( conn - > sslcrl ) ;
free ( conn - > sslcrldir ) ;
free ( conn - > sslcrldir ) ;
free ( conn - > sslcompression ) ;
free ( conn - > sslsni ) ;
free ( conn - > sslsni ) ;
free ( conn - > requirepeer ) ;
free ( conn - > requirepeer ) ;
free ( conn - > require_auth ) ;
free ( conn - > ssl_min_protocol_version ) ;
free ( conn - > ssl_max_protocol_version ) ;
free ( conn - > gssencmode ) ;
free ( conn - > gssencmode ) ;
free ( conn - > krbsrvname ) ;
free ( conn - > krbsrvname ) ;
free ( conn - > gsslib ) ;
free ( conn - > gsslib ) ;
free ( conn - > gssdelegation ) ;
free ( conn - > gssdelegation ) ;
free ( conn - > connip ) ;
free ( conn - > min_protocol_version ) ;
/* Note that conn->Pfdebug is not ours to close or free */
free ( conn - > max_protocol_version ) ;
free ( conn - > write_err_msg ) ;
free ( conn - > ssl_min_protocol_version ) ;
free ( conn - > inBuffer ) ;
free ( conn - > ssl_max_protocol_version ) ;
free ( conn - > outBuffer ) ;
free ( conn - > rowBuf ) ;
free ( conn - > target_session_attrs ) ;
free ( conn - > target_session_attrs ) ;
free ( conn - > require_auth ) ;
free ( conn - > load_balance_hosts ) ;
free ( conn - > load_balance_hosts ) ;
free ( conn - > scram_client_key ) ;
free ( conn - > scram_client_key ) ;
free ( conn - > scram_server_key ) ;
free ( conn - > scram_server_key ) ;
free ( conn - > sslkeylogfile ) ;
free ( conn - > oauth_issuer ) ;
free ( conn - > oauth_issuer ) ;
free ( conn - > oauth_issuer_id ) ;
free ( conn - > oauth_issuer_id ) ;
free ( conn - > oauth_discovery_uri ) ;
free ( conn - > oauth_discovery_uri ) ;
free ( conn - > oauth_client_id ) ;
free ( conn - > oauth_client_id ) ;
free ( conn - > oauth_client_secret ) ;
free ( conn - > oauth_client_secret ) ;
free ( conn - > oauth_scope ) ;
free ( conn - > oauth_scope ) ;
/* Note that conn->Pfdebug is not ours to close or free */
free ( conn - > events ) ;
pqReleaseConnHosts ( conn ) ;
free ( conn - > connip ) ;
release_conn_addrinfo ( conn ) ;
free ( conn - > scram_client_key_binary ) ;
free ( conn - > scram_server_key_binary ) ;
/* if this is a cancel connection, be_cancel_key may still be allocated */
free ( conn - > be_cancel_key ) ;
free ( conn - > inBuffer ) ;
free ( conn - > outBuffer ) ;
free ( conn - > rowBuf ) ;
termPQExpBuffer ( & conn - > errorMessage ) ;
termPQExpBuffer ( & conn - > errorMessage ) ;
termPQExpBuffer ( & conn - > workBuffer ) ;
termPQExpBuffer ( & conn - > workBuffer ) ;
@ -5147,6 +5150,7 @@ pqReleaseConnHosts(PGconn *conn)
}
}
}
}
free ( conn - > connhost ) ;
free ( conn - > connhost ) ;
conn - > connhost = NULL ;
}
}
}
}