fix svace issues 74/113374/1
authorKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 7 Feb 2017 08:34:02 +0000 (17:34 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 7 Feb 2017 08:36:14 +0000 (00:36 -0800)
Change-Id: If640fc43c9aade6fd36e46d4de50bc1005187a4b
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
framework/storage-handler/MsgStorageMessage.cpp
framework/transaction-manager/MsgTransManager.cpp
manager/src/msg-manager-notification.cpp
plugin/mms_plugin/MmsPluginDecode.cpp
plugin/mms_plugin/MmsPluginEncode.cpp
utils/MsgUtilFile.cpp

index 9634904..3198002 100755 (executable)
@@ -1203,8 +1203,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) {
@@ -1279,7 +1280,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) {
@@ -1354,18 +1357,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;
index 5c22741..fc5bd6b 100755 (executable)
@@ -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();
index 9ba4ed9..f1bc3ad 100644 (file)
@@ -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, &noti_info);
 
index 4f35fa3..6dbed34 100755 (executable)
@@ -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) {
index 1b535d6..84e7700 100755 (executable)
@@ -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);
                }
        }
index c7e4b03..0915819 100755 (executable)
@@ -1269,7 +1269,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);