From: Seonah Moon Date: Tue, 20 Mar 2018 05:32:00 +0000 (+0900) Subject: Fix svace issue X-Git-Tag: accepted/tizen/unified/20180322.060201~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F173226%2F2;p=platform%2Fframework%2Fweb%2Fdownload-provider.git Fix svace issue WGID-328327 Change-Id: I797fad91a019e1ea666c57e55be5073f65ba9040 --- diff --git a/packaging/download-provider.spec b/packaging/download-provider.spec index 18146b3..590b880 100755 --- a/packaging/download-provider.spec +++ b/packaging/download-provider.spec @@ -1,6 +1,6 @@ Name: download-provider Summary: Download the contents in background -Version: 2.1.92 +Version: 2.1.93 Release: 0 Group: Development/Libraries License: Apache-2.0 diff --git a/provider/download-provider-db.c b/provider/download-provider-db.c index 0cf3cc9..ccc05e1 100755 --- a/provider/download-provider-db.c +++ b/provider/download-provider-db.c @@ -50,6 +50,7 @@ static void __dp_finalize(sqlite3_stmt *stmt) static int __check_integrity(sqlite3 *handle) { sqlite3_stmt *stmt = NULL; + int ret = 0; if (handle == 0) { TRACE_ERROR("failed to check handle"); @@ -57,26 +58,23 @@ static int __check_integrity(sqlite3 *handle) } TRACE_INFO(""); - int ret = sqlite3_prepare_v2(handle, "PRAGMA integrity_check", -1, &stmt, NULL); - if (ret != SQLITE_OK && ret != SQLITE_BUSY) { + int errorcode = sqlite3_prepare_v2(handle, "PRAGMA integrity_check", -1, &stmt, NULL); + if (errorcode != SQLITE_OK && errorcode != SQLITE_BUSY) { TRACE_ERROR("failed to check integrity:%s", sqlite3_errmsg(handle)); - return -1; + ret = -1; } else { - ret = sqlite3_step(stmt); - if (ret == SQLITE_ROW) { + errorcode = sqlite3_step(stmt); + if (errorcode == SQLITE_ROW) { const char *ret_val = (const char *)sqlite3_column_text(stmt, 0); TRACE_INFO("ret_val: %s", ret_val); - if (ret_val && strcmp(ret_val, "ok") == 0) { - return 0; - } else { + if (!ret_val || strcmp(ret_val, "ok") != 0) { TRACE_ERROR("failed to check integrity"); - return -1; + ret = -1; } - } else { - return 0; } } - return 0; + __dp_finalize(stmt); + return ret; } static int __check_table(sqlite3 *handle, char *table)