[Messaging] Replacing call of email_attachment_data_t structure constructor to calloc 44/137944/2
authorSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Fri, 7 Jul 2017 12:41:54 +0000 (14:41 +0200)
committerSzymon Jastrzebski <s.jastrzebsk@partner.samsung.com>
Tue, 11 Jul 2017 08:04:00 +0000 (10:04 +0200)
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 <s.jastrzebsk@partner.samsung.com>
src/messaging/message.cc

index bdd7873..57703b1 100755 (executable)
@@ -591,7 +591,7 @@ PlatformResult addSingleEmailAttachment(std::shared_ptr<Message> 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());