Coverity error handling 52/200852/2
authordeepti <d.saraswat@samsung.com>
Mon, 4 Mar 2019 11:44:17 +0000 (17:14 +0530)
committerdeepti <d.saraswat@samsung.com>
Thu, 7 Mar 2019 07:19:17 +0000 (12:49 +0530)
This patch handles return value from sqlite3 function

Coverity: 108596

Reference : https://review.tizen.org/gerrit/#/c/platform/framework/web/crosswalk-tizen/+/175086/

Change-Id: I1e472b893c1cec8fc8d2241c9bb9aeaad30f6285
Signed-off-by: deepti <d.saraswat@samsung.com>
common/app_db.cc

index fa6a3c6..386b8da 100644 (file)
@@ -218,7 +218,7 @@ void SqliteDB::Initialize() {
     sqldb_ = NULL;
     return;
   }
-  sqlite3_busy_handler(sqldb_, [](void *, int count) {
+  ret = sqlite3_busy_handler(sqldb_, [](void *, int count) {
     if (count < 5) {
       LOGGER(ERROR) << "App db was busy, Wait the lock count(" << count << ")";
       usleep(100000*(count+1));
@@ -228,6 +228,9 @@ void SqliteDB::Initialize() {
       return 0;
     }
   }, NULL);
+  if (ret != SQLITE_OK) {
+    LOGGER(ERROR) << "Failed to register busy handler: " << sqlite3_errmsg(sqldb_);
+  }
 
   char *errmsg = NULL;
   ret = sqlite3_exec(sqldb_, kCreateDbQuery, NULL, NULL, &errmsg);