From: Sang-Hun Chung Date: Thu, 10 Jan 2013 08:00:28 +0000 (+0900) Subject: prevent 33693, 33351 fixed X-Git-Tag: submit/submit/20141001.115906~33^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5a9062fcaf0fd2144ca19c0601e344c99ebb44a;p=platform%2Fframework%2Fnative%2Fmessaging.git prevent 33693, 33351 fixed --- diff --git a/email-core/email-core-event.c b/email-core/email-core-event.c index 31e418e..8115da3 100755 --- a/email-core/email-core-event.c +++ b/email-core/email-core-event.c @@ -1861,7 +1861,7 @@ int event_handler_EMAIL_EVENT_MOVE_MAIL(int account_id, int *mail_ids, int mail_ ret = true; FINISH_OFF: - + EM_SAFE_FREE(mail_ids); /*prevent 33693*/ if (error) *error = err; @@ -2361,7 +2361,7 @@ void* thread_func_branch_command(void *arg) case EMAIL_EVENT_MOVE_MAIL: event_handler_EMAIL_EVENT_MOVE_MAIL(event_data.account_id, (int *)event_data.event_param_data_3, event_data.event_param_data_4, event_data.event_param_data_5, event_data.event_param_data_8, handle_to_be_published, &err); - EM_SAFE_FREE(event_data.event_param_data_3); + event_data.event_param_data_3 = NULL; /*prevent 33693*/ break; case EMAIL_EVENT_VALIDATE_ACCOUNT: diff --git a/email-core/email-storage/email-storage.c b/email-core/email-storage/email-storage.c index 9d18745..44b5b6e 100755 --- a/email-core/email-storage/email-storage.c +++ b/email-core/email-storage/email-storage.c @@ -1470,51 +1470,55 @@ INTERNAL_FUNC int em_db_open(sqlite3 **sqlite_handle, int *err_code) EM_DEBUG_LOG("*sqlite_handle[%p]", *sqlite_handle); - if (NULL == *sqlite_handle) { - /* db open */ - EM_DEBUG_LOG("Open DB"); - EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc); - if (SQLITE_OK != rc) { - EM_DEBUG_EXCEPTION("db_util_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); - error = EMAIL_ERROR_DB_FAILURE; - db_util_close(*sqlite_handle); - *sqlite_handle = NULL; + if (*sqlite_handle) { /*prevent 33351*/ + EM_DEBUG_LOG(">>>>> DB Already Opened......"); + if (err_code != NULL) + *err_code = error; + return true; + } - if (SQLITE_CORRUPT == rc) /* SQLITE_CORRUPT : The database disk image is malformed */ {/* Recovery DB file */ - EM_DEBUG_LOG("The database disk image is malformed. Trying to remove and create database disk image and directories"); - if (!_recovery_from_malformed_db_file(&error)) { - EM_DEBUG_EXCEPTION("_recovery_from_malformed_db_file failed [%d]", error); - goto FINISH_OFF; - } - - EM_DEBUG_LOG("Open DB again"); - EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc); - if (SQLITE_OK != rc) { - EM_DEBUG_EXCEPTION("db_util_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); - error = EMAIL_ERROR_DB_FAILURE; - db_util_close(*sqlite_handle); - *sqlite_handle = NULL; - } + /* db open */ + EM_DEBUG_LOG("Open DB"); + EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc); + if (SQLITE_OK != rc) { + EM_DEBUG_EXCEPTION("db_util_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); + error = EMAIL_ERROR_DB_FAILURE; + db_util_close(*sqlite_handle); + *sqlite_handle = NULL; + + if (SQLITE_CORRUPT == rc) /* SQLITE_CORRUPT : The database disk image is malformed */ {/* Recovery DB file */ + EM_DEBUG_LOG("The database disk image is malformed. Trying to remove and create database disk image and directories"); + if (!_recovery_from_malformed_db_file(&error)) { + EM_DEBUG_EXCEPTION("_recovery_from_malformed_db_file failed [%d]", error); + goto FINISH_OFF; } - else - goto FINISH_OFF; - } - EM_DEBUG_LOG(">>>>> DB Handle : *sqlite_handle[%p]", *sqlite_handle); - /* register busy handler */ - EM_DEBUG_LOG(">>>>> Register busy handler....."); - rc = sqlite3_busy_handler(*sqlite_handle, _callback_sqlite_busy_handler, NULL); /* Busy Handler registration, NULL is a parameter which will be passed to handler */ - if (SQLITE_OK != rc) { - EM_DEBUG_EXCEPTION("sqlite3_busy_handler fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); - error = EMAIL_ERROR_DB_FAILURE; - db_util_close(*sqlite_handle); - *sqlite_handle = NULL; - goto FINISH_OFF; + EM_DEBUG_LOG("Open DB again"); + EMSTORAGE_PROTECTED_FUNC_CALL(db_util_open(EMAIL_SERVICE_DB_FILE_PATH, sqlite_handle, DB_UTIL_REGISTER_HOOK_METHOD), rc); + if (SQLITE_OK != rc) { + EM_DEBUG_EXCEPTION("db_util_open fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); + error = EMAIL_ERROR_DB_FAILURE; + db_util_close(*sqlite_handle); + *sqlite_handle = NULL; + goto FINISH_OFF; /*prevent 33351*/ + } } + else + goto FINISH_OFF; } - else { - EM_DEBUG_LOG(">>>>> DB Already Opened......"); + EM_DEBUG_LOG(">>>>> DB Handle : *sqlite_handle[%p]", *sqlite_handle); + + /* register busy handler */ + EM_DEBUG_LOG(">>>>> Register busy handler....."); + rc = sqlite3_busy_handler(*sqlite_handle, _callback_sqlite_busy_handler, NULL); /* Busy Handler registration, NULL is a parameter which will be passed to handler */ + if (SQLITE_OK != rc) { + EM_DEBUG_EXCEPTION("sqlite3_busy_handler fail:%d -%s", rc, sqlite3_errmsg(*sqlite_handle)); + error = EMAIL_ERROR_DB_FAILURE; + db_util_close(*sqlite_handle); + *sqlite_handle = NULL; + goto FINISH_OFF; } + ret = true; diff --git a/email-daemon/email-daemon-mail.c b/email-daemon/email-daemon-mail.c index 69300e6..c117164 100755 --- a/email-daemon/email-daemon-mail.c +++ b/email-daemon/email-daemon-mail.c @@ -517,6 +517,7 @@ void* thread_func_to_delete_mail(void *thread_argument) FINISH_OFF: /* emcore_free_event(event_data); */ /* all of members will be freed after using in each event handler */ + EM_SAFE_FREE(event_data->event_param_data_3); /*prevent 33692*/ EM_SAFE_FREE(event_data); EM_DEBUG_FUNC_END(); @@ -711,7 +712,7 @@ void* thread_func_to_move_mail(void *thread_argument) char *dst_mailbox_name = NULL; int dst_mailbox_id = 0; - dst_mailbox_name = (char*)event_data->event_param_data_1; +/* dst_mailbox_name = (char*)event_data->event_param_data_1; */ /*prevent 33693*/ mail_ids = (int*)event_data->event_param_data_3; mail_ids_count = event_data->event_param_data_4; dst_mailbox_id = event_data->event_param_data_5;