From: Baptiste DURAND Date: Tue, 23 Sep 2014 11:53:03 +0000 (+0200) Subject: Add robstness in case of error during sqlite request execution X-Git-Tag: accepted/tizen/common/20140923.145814^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e3ef0968ba539a3c224c593ffe1d4d47cbc2ac5;p=platform%2Fcore%2Fappfw%2Fail.git Add robstness in case of error during sqlite request execution BUG=TC-1624 Change-Id: I30aac4d39d81283f41a5c894b9e842fcd2ad1c64 Signed-off-by: Baptiste DURAND --- diff --git a/src/ail_db.c b/src/ail_db.c index bfa3ced..e878317 100755 --- a/src/ail_db.c +++ b/src/ail_db.c @@ -544,7 +544,7 @@ ail_error_e db_finalize(sqlite3_stmt *stmt) ail_error_e do_db_exec(const char *query, sqlite3 * fileSQL) { int ret; - char *errmsg; + char *errmsg = NULL; retv_if(!query, AIL_ERROR_INVALID_PARAMETER); retv_if(!fileSQL, AIL_ERROR_DB_FAILED); @@ -553,7 +553,8 @@ ail_error_e do_db_exec(const char *query, sqlite3 * fileSQL) if (ret != SQLITE_OK) { _E("Cannot execute this query - %s. because %s", query, errmsg? errmsg:"uncatched error"); - sqlite3_free(errmsg); + if(errmsg) + sqlite3_free(errmsg); return AIL_ERROR_DB_FAILED; }