summaryrefslogtreecommitdiff
path: root/ext/sqlite3
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-12 10:18:19 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-12 10:18:19 +0200
commit13868508386208f5a1a43b6c17991ad6f3652fea (patch)
tree5e05b3d60bc7386af22ffce590fb8bd5b0c2952c /ext/sqlite3
parentf691693ebc7a0f6604455c004dc1ba78251c0ac1 (diff)
downloadphp-git-13868508386208f5a1a43b6c17991ad6f3652fea.tar.gz
Use unused attribute for _dummy
The (void)_dummy is apparently considered a read of an uninitialized variable. As it is a _Bool now, which has trap representations, this is no longer considered legal and results in somewhat odd ubsan warnings of the form: runtime error: load of value 0, which is not a valid value for type 'zend_bool' (aka 'bool')
Diffstat (limited to 'ext/sqlite3')
-rw-r--r--ext/sqlite3/sqlite3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index c309d5d545..895a1b0cfd 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -135,13 +135,13 @@ PHP_METHOD(SQLite3, open)
rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL);
if (rc != SQLITE_OK) {
+ sqlite3_close(db_obj->db);
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s",
#ifdef HAVE_SQLITE3_ERRSTR
db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc));
#else
db_obj->db ? sqlite3_errmsg(db_obj->db) : "");
#endif
- sqlite3_close(db_obj->db);
if (fullpath != filename) {
efree(fullpath);
}
@@ -151,8 +151,8 @@ PHP_METHOD(SQLite3, open)
#ifdef SQLITE_HAS_CODEC
if (encryption_key_len > 0) {
if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) {
- zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
sqlite3_close(db_obj->db);
+ zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
RETURN_THROWS();
}
}