From 41cb1e2a73a9b94994e291ae6ce3e6fc8df24ab0 Mon Sep 17 00:00:00 2001 From: "saerome.kim" Date: Mon, 23 Sep 2019 17:45:19 +0900 Subject: [PATCH] Fixed a coverity issue. - 1087243 (#1 of 1): var_deref_model: Passing null pointer database to sqlite3_busy_handler, which dereferences it. Change-Id: I7ca3b4ec8c3fe26544ae7a2986088fae76e8cd9a Signed-off-by: saerome.kim --- packaging/ua-manager.spec | 2 +- ua-daemon/src/ua-manager-db.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packaging/ua-manager.spec b/packaging/ua-manager.spec index a382a57..aaf1bc4 100644 --- a/packaging/ua-manager.spec +++ b/packaging/ua-manager.spec @@ -1,6 +1,6 @@ Name: ua-manager Summary: User awareness manager -Version: 0.9.3 +Version: 0.9.4 Release: 1 License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/ua-daemon/src/ua-manager-db.c b/ua-daemon/src/ua-manager-db.c index 74c01ca..7f6d568 100644 --- a/ua-daemon/src/ua-manager-db.c +++ b/ua-daemon/src/ua-manager-db.c @@ -394,6 +394,7 @@ int _uam_db_initialize_once(void) char *sql; int max_retries = 2; + int max_attempts = 10; do { /* open database */ @@ -415,8 +416,12 @@ int _uam_db_initialize_once(void) retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, NULL), UAM_ERROR_DB_FAILED); sqlite3_free(sql); + if (NULL == database) { + unlink(DATABASE_FULL_PATH); + return UAM_ERROR_DB_FAILED; + } + /* Set how many times we'll repeat our attempts for sqlite_step */ - int max_attempts = 10; if (SQLITE_OK != sqlite3_busy_handler(database, __uam_db_busy, &max_attempts)) UAM_ERR("Couldn't set busy handler!"); -- 2.7.4