From 4c236233a4dbfee12a27efcc30a25a442471d97c Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Fri, 7 Jul 2017 14:41:54 +0200 Subject: [PATCH] [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 --- src/messaging/message.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/messaging/message.cc b/src/messaging/message.cc index bdd7873f..57703b13 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()); -- 2.34.1