alloc-dealloc mismatch fixed 72/73372/4
authorKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 8 Jun 2016 01:58:53 +0000 (10:58 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Wed, 8 Jun 2016 04:31:47 +0000 (13:31 +0900)
Change-Id: I7bcde4f03f63a1b85d4bab708912c71fda2fc3fb
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
framework/storage-handler/MsgStorageMessage.cpp
mapi/msg_storage.cpp
mapi/msg_svc.cpp
plugin/mms_plugin/MmsPluginInternal.cpp
utils/MsgSerialize.cpp
utils/MsgVMessage.cpp

index 60238e7..853da57 100755 (executable)
@@ -2094,7 +2094,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M
                err =  plg->getMmsMessage(pMsg, pSendOptInfo, &pDestMsg);
                if (err != MSG_SUCCESS) {
                        if (pDestMsg) {
-                               free(pDestMsg);
+                               delete [] pDestMsg;
                                pDestMsg = NULL;
                        }
                        return MSG_ERR_STORAGE_ERROR;
@@ -2110,7 +2110,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M
 
                        if (MsgCreateFileName(tempFileName) == false) {
                                if(pDestMsg) {
-                                       free(pDestMsg);
+                                       delete [] pDestMsg;
                                        pDestMsg = NULL;
                                }
                                return MSG_ERR_STORAGE_ERROR;
@@ -2119,7 +2119,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M
 
                        if (MsgWriteIpcFile(tempFileName, pDestMsg, pMsg->dataSize) == false) {
                                if(pDestMsg) {
-                                       free(pDestMsg);
+                                       delete [] pDestMsg;
                                        pDestMsg = NULL;
                                }
                                return MSG_ERR_STORAGE_ERROR;
@@ -2134,7 +2134,7 @@ msg_error_t MsgStoGetMessage(msg_message_id_t msgId, MSG_MESSAGE_INFO_S *pMsg, M
                pMsg->dataSize = temp_size; /*raw file size; */
 
                if (pDestMsg) {
-                       free(pDestMsg);
+                       delete [] pDestMsg;
                        pDestMsg = NULL;
                }
        }
index dd85abe..6609440 100755 (executable)
@@ -2245,7 +2245,7 @@ int msg_list_condition_set_str(void *condition_info, int field, const char *valu
        case MSG_LIST_CONDITION_ADDRESS_VALUE_STR:
                if (size) {
                        if (cond->pAddressVal) {
-                               delete cond->pAddressVal;
+                               delete [] cond->pAddressVal;
                                cond->pAddressVal = NULL;
                        }
                        cond->pAddressVal = (char *)new char[size+1];
@@ -2259,7 +2259,7 @@ int msg_list_condition_set_str(void *condition_info, int field, const char *valu
        case MSG_LIST_CONDITION_TEXT_VALUE_STR:
                if (size) {
                        if (cond->pTextVal) {
-                               delete cond->pTextVal;
+                               delete [] cond->pTextVal;
                                cond->pTextVal = NULL;
                        }
                        cond->pTextVal = (char *)new char[size+1];
index bc96798..80755ad 100755 (executable)
@@ -461,12 +461,12 @@ static int _release_msg_struct(msg_struct_t *msg_struct_handle)
                pCond->sortRule = NULL;
 
                if (pCond->pAddressVal) {
-                       delete pCond->pAddressVal;
+                       delete [] pCond->pAddressVal;
                        pCond->pAddressVal = NULL;
                }
 
                if (pCond->pTextVal) {
-                       delete pCond->pTextVal;
+                       delete [] pCond->pTextVal;
                        pCond->pTextVal = NULL;
                }
 
index 3708b7c..ca89aaf 100755 (executable)
@@ -240,7 +240,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
                        snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName);
                }
 
-               free(pSerializedMms);
+               delete [] pSerializedMms;
        }
 
                MsgMmsRelease(&mms_data);
index 1876590..df0f9fd 100755 (executable)
@@ -626,10 +626,12 @@ int MsgSerializeMms(const MMS_DATA_S *pMsgData, char **pValue)
 
        MSG_DEBUG("Serialize bufsize = %d", bufsize);
 
-       buf = (char *)calloc(1, bufsize);
+       buf = new char[bufsize];
        if (buf == NULL)
                return -1;
 
+       memset(buf, 0x00, bufsize);
+
        int serial_index = 0;
        int offset = 0;
 
index c03c8d7..db94009 100755 (executable)
@@ -1165,7 +1165,7 @@ char *MsgVMessageEncode(MSG_MESSAGE_INFO_S *pMsg)
                pObject->valueCount = 1;
 
                if (pFileData) {
-                       free(pFileData);
+                       delete [] pFileData;
                        pFileData = NULL;
                }
        }