From: Seunghwan Lee Date: Sun, 14 Jul 2013 11:12:38 +0000 (+0900) Subject: apply dynamic alloc MMS_MULTIPART_DATA_S value X-Git-Tag: submit/tizen_2.2/20130716.173349~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c91f5bedddd48eff9a2faba74378da9422b9dbb4;p=framework%2Fmessaging%2Fmsg-service.git apply dynamic alloc MMS_MULTIPART_DATA_S value Change-Id: Id827db39b841708289fce5fcee682c3cb5c777ad --- diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp index e6f2c76..17b223d 100755 --- a/plugin/mms_plugin/MmsPluginMessage.cpp +++ b/plugin/mms_plugin/MmsPluginMessage.cpp @@ -647,7 +647,7 @@ bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDIN //setting adddress MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo); - MmsGetMsgBodyfromMsgInfo(pMsgInfo, pMsgData, pFileData); + //MmsGetMsgBodyfromMsgInfo(pMsgInfo, pMsgData, pFileData); int pageCnt = _MsgMmsGetPageCount(pMsgData); @@ -1539,16 +1539,23 @@ bool MmsComposeSendReq(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDIN for (int j = 0; j < mediaCnt; ++j) { MMS_MEDIA_S *pMedia = _MsgMmsGetMedia(pPage, j); if (pMedia->szFilePath[0] != 0) { - MMS_MULTIPART_DATA_S pMultipart; - bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S)); - snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", pMedia->szContentID); - snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", pMedia->szContentLocation); - snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", pMedia->szFileName); - snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", pMedia->szFilePath); - snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", pMedia->szContentType); - - if (!MmsInsertPartFromMultipart(pMmsMsg, &pMultipart)) - return false; + MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)calloc(1, sizeof(MMS_MULTIPART_DATA_S)); + if (pMultipart) { + snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMedia->szContentID); + snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMedia->szContentLocation); + snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMedia->szFileName); + snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", pMedia->szFilePath); + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", pMedia->szContentType); + + if (!MmsInsertPartFromMultipart(pMmsMsg, pMultipart)) { + free(pMultipart); + pMultipart = NULL; + return false; + } + + free(pMultipart); + pMultipart = NULL; + } } } } @@ -1558,16 +1565,23 @@ bool MmsComposeSendReq(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDIN for (int i = 0; i < _MsgMmsGetAttachCount(pMsgData); ++i) { MMS_ATTACH_S *pMedia = _MsgMmsGetAttachment(pMsgData, i); if (pMedia->szFilePath[0] != 0) { - MMS_MULTIPART_DATA_S pMultipart; - bzero(&pMultipart, sizeof(MMS_MULTIPART_DATA_S)); - snprintf(pMultipart.szContentID, sizeof(pMultipart.szContentID), "%s", pMedia->szFileName); - snprintf(pMultipart.szContentLocation, sizeof(pMultipart.szContentLocation), "%s", pMedia->szFileName); - snprintf(pMultipart.szFileName, sizeof(pMultipart.szFileName), "%s", pMedia->szFileName); - snprintf(pMultipart.szFilePath, sizeof(pMultipart.szFilePath), "%s", pMedia->szFilePath); - snprintf(pMultipart.szContentType, sizeof(pMultipart.szContentType), "%s", pMedia->szContentType); - - if (!MmsInsertPartFromMultipart(pMmsMsg, &pMultipart)) - return false; + MMS_MULTIPART_DATA_S *pMultipart = (MMS_MULTIPART_DATA_S *)calloc(1, sizeof(MMS_MULTIPART_DATA_S)); + if (pMultipart) { + snprintf(pMultipart->szContentID, sizeof(pMultipart->szContentID), "%s", pMedia->szFileName); + snprintf(pMultipart->szContentLocation, sizeof(pMultipart->szContentLocation), "%s", pMedia->szFileName); + snprintf(pMultipart->szFileName, sizeof(pMultipart->szFileName), "%s", pMedia->szFileName); + snprintf(pMultipart->szFilePath, sizeof(pMultipart->szFilePath), "%s", pMedia->szFilePath); + snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", pMedia->szContentType); + + if (!MmsInsertPartFromMultipart(pMmsMsg, pMultipart)) { + free(pMultipart); + pMultipart = NULL; + return false; + } + + free(pMultipart); + pMultipart = NULL; + } } } diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp index f7fe9b2..c32b24b 100755 --- a/plugin/mms_plugin/MmsPluginStorage.cpp +++ b/plugin/mms_plugin/MmsPluginStorage.cpp @@ -1106,7 +1106,11 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I } MmsReleaseMmsMsg(pMmsMsg); + MMS_FREE(pMmsMsg); + MsgMmsReleaseMmsLists(pMmsMsgData); + MMS_FREE(pMmsMsgData); + } else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) { MmsComposeNotiMessage(pMmsMsg, pMsgInfo->msgId); @@ -1118,6 +1122,7 @@ void MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_I } MmsReleaseMmsMsg(pMmsMsg); + MMS_FREE(pMmsMsg); } else if (pMsgInfo->msgType.subType == MSG_SENDCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) { MmsMsg *pMsg = NULL;