Skip to content

Commit 2ba10ad

Browse files
committed
Revert accidental change
Not sure how this happened, but I seem to have reverted 2fd278b as part of 1386850. Restore the change.
1 parent c7ad8a8 commit 2ba10ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ PHP_METHOD(SQLite3, open)
135135

136136
rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL);
137137
if (rc != SQLITE_OK) {
138-
sqlite3_close(db_obj->db);
139138
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s",
140139
#ifdef HAVE_SQLITE3_ERRSTR
141140
db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc));
142141
#else
143142
db_obj->db ? sqlite3_errmsg(db_obj->db) : "");
144143
#endif
144+
sqlite3_close(db_obj->db);
145145
if (fullpath != filename) {
146146
efree(fullpath);
147147
}
@@ -151,8 +151,8 @@ PHP_METHOD(SQLite3, open)
151151
#ifdef SQLITE_HAS_CODEC
152152
if (encryption_key_len > 0) {
153153
if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) {
154-
sqlite3_close(db_obj->db);
155154
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
155+
sqlite3_close(db_obj->db);
156156
RETURN_THROWS();
157157
}
158158
}

0 commit comments

Comments
 (0)