File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -541,21 +541,22 @@ conn_setup(connectionObject *self, PGconn *pgconn)
541541{
542542 PGresult * pgres = NULL ;
543543 char * error = NULL ;
544+ int rv = -1 ;
544545
545546 self -> equote = conn_get_standard_conforming_strings (pgconn );
546547 self -> server_version = conn_get_server_version (pgconn );
547548 self -> protocol = conn_get_protocol_version (self -> pgconn );
548549 if (3 != self -> protocol ) {
549550 PyErr_SetString (InterfaceError , "only protocol 3 supported" );
550- return -1 ;
551+ goto exit ;
551552 }
552553
553554 if (0 > conn_read_encoding (self , pgconn )) {
554- return -1 ;
555+ goto exit ;
555556 }
556557
557558 if (0 > conn_setup_cancel (self , pgconn )) {
558- return -1 ;
559+ goto exit ;
559560 }
560561
561562 Py_BEGIN_ALLOW_THREADS ;
@@ -570,18 +571,23 @@ conn_setup(connectionObject *self, PGconn *pgconn)
570571 Py_BLOCK_THREADS ;
571572 if (res < 0 ) {
572573 pq_complete_error (self , & pgres , & error );
573- return -1 ;
574+ goto unlock ;
574575 }
575576 }
576577
577578 /* for reset */
578579 self -> autocommit = 0 ;
579580
581+ /* success */
582+ rv = 0 ;
583+
584+ unlock :
580585 Py_UNBLOCK_THREADS ;
581586 pthread_mutex_unlock (& self -> lock );
582587 Py_END_ALLOW_THREADS ;
583588
584- return 0 ;
589+ exit :
590+ return rv ;
585591}
586592
587593/* conn_connect - execute a connection to the database */
You can’t perform that action at this time.
0 commit comments