From: Szymon Jastrzebski Date: Fri, 7 Jul 2017 12:41:54 +0000 (+0200) Subject: [Messaging] Replacing call of email_attachment_data_t structure constructor to calloc X-Git-Tag: accepted/tizen/3.0/common/20170713.114200~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F137944%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Messaging] Replacing call of email_attachment_data_t structure constructor to calloc Native function email_free_attachment_data uses free() to release allocated memory pointing by tmp. Thus, we should call calloc() instead of structure's constructor. Messaging-email TCT passed 100%. Change-Id: Ib81f1da2e0270cfa76aef0eab7005d968c1f102c Signed-off-by: Szymon Jastrzebski --- diff --git a/src/messaging/message.cc b/src/messaging/message.cc index bdd7873..57703b1 100755 --- a/src/messaging/message.cc +++ b/src/messaging/message.cc @@ -591,7 +591,7 @@ PlatformResult addSingleEmailAttachment(std::shared_ptr message, PlatformResult ret = copyFileToTemp(att->getFilePath(), &dirPath); if (ret.IsError()) return ret; - email_attachment_data_t* tmp = new email_attachment_data_t(); + email_attachment_data_t* tmp = (email_attachment_data_t*)calloc(1, sizeof(email_attachment_data_t)); tmp->attachment_name = strdup(att->getShortFileName().c_str()); tmp->attachment_path = strdup(std::string(dirPath + "/" + att->getShortFileName()).c_str());