From: Kyeonghun Lee Date: Tue, 7 Feb 2017 08:34:02 +0000 (+0900) Subject: fix svace issues X-Git-Tag: submit/tizen_3.0/20170208.044714~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65c2adb74e594f3c1de66a4fbde05df4f8ebc5ba;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git fix svace issues Change-Id: If640fc43c9aade6fd36e46d4de50bc1005187a4b Signed-off-by: Kyeonghun Lee --- diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index 28dfccc..53b6647 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -1193,8 +1193,9 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD MSGFW_MMS_MULTIPART_TABLE_NAME); if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { + err = MSG_ERR_DB_PREPARE; dbHandle->endTrans(false); - return MSG_ERR_DB_PREPARE; + goto FREE_MEMORY; } while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { @@ -1269,7 +1270,9 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) { dbHandle->endTrans(false); - return MSG_ERR_DB_PREPARE; + err = MSG_ERR_DB_PREPARE; + + goto FREE_MEMORY; } while (dbHandle->stepQuery() == MSG_ERR_DB_ROW) { @@ -1344,18 +1347,17 @@ msg_error_t MsgStoDeleteAllMessageInFolder(msg_folder_id_t folderId, bool bOnlyD /* Create thread for noti and phone log delete. */ if (!bOnlyDB) { - if (pToDeleteMsgIdList->nCount > 0) { - /* memory free */ - if (pToDeleteMsgIdList != NULL) { - /*free peer info list */ - if (pToDeleteMsgIdList->msgIdList != NULL) - delete [] pToDeleteMsgIdList->msgIdList; - - delete [] pToDeleteMsgIdList; - } - + if (pToDeleteMsgIdList->nCount > 0) MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE); - } + } + + /* memory free */ + if (pToDeleteMsgIdList != NULL) { + /*free peer info list */ + if (pToDeleteMsgIdList->msgIdList != NULL) + delete [] pToDeleteMsgIdList->msgIdList; + + delete [] pToDeleteMsgIdList; } return MSG_SUCCESS; diff --git a/framework/transaction-manager/MsgTransManager.cpp b/framework/transaction-manager/MsgTransManager.cpp index fd7001d..b965204 100755 --- a/framework/transaction-manager/MsgTransManager.cpp +++ b/framework/transaction-manager/MsgTransManager.cpp @@ -91,6 +91,10 @@ MsgIpcServerSocket MsgTransactionManager::servSock; MsgTransactionManager::MsgTransactionManager() : running(false), mx(), mxQ(), cv(), eventQueue() { + p_cynara = NULL; + client_method = CLIENT_METHOD_DEFAULT; + user_method = USER_METHOD_DEFAULT; + sentMsgMap.clear(); statusCBFdMap.clear(); newMsgCBList.clear(); diff --git a/manager/src/msg-manager-notification.cpp b/manager/src/msg-manager-notification.cpp index 6f4e50a..d86e6a0 100644 --- a/manager/src/msg-manager-notification.cpp +++ b/manager/src/msg-manager-notification.cpp @@ -443,9 +443,6 @@ int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_M notification_h noti_h = NULL; bool isNewNoti = false; - report_notification_s *info = new report_notification_s; - memset(info, 0x00, sizeof(report_notification_s)); - MSG_MGR_NOTI_INFO_S noti_info = {0, }; noti_info.type = noti_type; @@ -510,11 +507,6 @@ int MsgMgrAddReportNotification(msg_mgr_notification_type_t noti_type, MSG_MGR_M } } - info->priv_id = noti_info.id; - snprintf(info->addressVal, sizeof(info->addressVal), "%s", msg_info->addressVal); - msg_report_notification_list = g_list_append(msg_report_notification_list, (void *)info); - MSG_MGR_SEC_DEBUG("appended list data = [priv_id = %d address = %s]", info->priv_id, info->addressVal); - __END_OF_ADD_REPORT_NOTI : clearInfoData(noti_h, ¬i_info); diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp index 4f35fa3..6dbed34 100755 --- a/plugin/mms_plugin/MmsPluginDecode.cpp +++ b/plugin/mms_plugin/MmsPluginDecode.cpp @@ -502,6 +502,11 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength) case MMS_CODE_FROM: + if (mmsHeader.pFrom != NULL) { + MSG_DEBUG("MMS_CODE_FROM is already decoded"); + goto __CATCH; + } + /* Value-length (Address-present-token Encoded-string-value | Insert-address-token) */ if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) { diff --git a/plugin/mms_plugin/MmsPluginEncode.cpp b/plugin/mms_plugin/MmsPluginEncode.cpp index 1b535d6..84e7700 100755 --- a/plugin/mms_plugin/MmsPluginEncode.cpp +++ b/plugin/mms_plugin/MmsPluginEncode.cpp @@ -1426,13 +1426,13 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType) length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName); + g_free(pszName); + if (length == -1) { MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail"); goto __CATCH; } - g_free(pszName); - totalLength += (length + 1); } } diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index 510d8f1..9024e01 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -1264,7 +1264,7 @@ int MsgTcsScanFile(const char *filepath, int *bLevel) ret = csr_cs_scan_file(csr_handle, filepath, &detected); if (ret == CSR_ERROR_NONE) { if (detected) { - csr_cs_severity_level_e severity; + csr_cs_severity_level_e severity = CSR_CS_SEVERITY_LOW; char *name = NULL; ret = csr_cs_malware_get_severity(detected, &severity);