Skip to content

Commit 2433210

Browse files
committed
changes from feedback
1 parent 0f7bfca commit 2433210

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

ext/dba/dba.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -864,12 +864,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
864864
}
865865
if (!connection->info->lock.fp) {
866866
/* stream operation already wrote an error message */
867-
efree(resource_key);
868-
zend_string_release_ex(connection->hash, persistent);
869-
dba_close_info(connection->info);
870-
connection->info = NULL;
871-
zval_ptr_dtor(return_value);
872-
RETURN_FALSE;
867+
goto fail;
873868
}
874869
if (!error && !php_stream_supports_lock(connection->info->lock.fp)) {
875870
error = "Stream does not support locking";
@@ -888,12 +883,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
888883
}
889884
if (!connection->info->fp) {
890885
/* stream operation already wrote an error message */
891-
efree(resource_key);
892-
zend_string_release_ex(connection->hash, persistent);
893-
dba_close_info(connection->info);
894-
connection->info = NULL;
895-
zval_ptr_dtor(return_value);
896-
RETURN_FALSE;
886+
goto fail;
897887
}
898888
if (hptr->flags & (DBA_NO_APPEND|DBA_CAST_AS_FD)) {
899889
/* Needed because some systems do not allow to write to the original
@@ -940,12 +930,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
940930
php_error_docref(NULL, E_WARNING, "Driver initialization failed for handler: %s", hptr->name);
941931
}
942932
}
943-
efree(resource_key);
944-
zend_string_release_ex(connection->hash, persistent);
945-
dba_close_info(connection->info);
946-
connection->info = NULL;
947-
zval_ptr_dtor(return_value);
948-
RETURN_FALSE;
933+
goto fail;
949934
}
950935

951936
connection->info->hnd = hptr;
@@ -962,6 +947,14 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, bool persistent)
962947

963948
zend_hash_add_new(&DBA_G(connections), connection->hash, return_value);
964949
efree(resource_key);
950+
return;
951+
fail:
952+
efree(resource_key);
953+
zend_string_release_ex(connection->hash, persistent);
954+
dba_close_info(connection->info);
955+
connection->info = NULL;
956+
zval_ptr_dtor(return_value);
957+
RETURN_FALSE;
965958
}
966959
/* }}} */
967960

0 commit comments

Comments
 (0)