[Messaging] Prevent crash of using released structure mail_data_final 17/268817/1
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Fri, 24 Dec 2021 09:38:57 +0000 (10:38 +0100)
committerPiotr Kosko <p.kosko@samsung.com>
Mon, 3 Jan 2022 09:04:23 +0000 (09:04 +0000)
commitb952458182dc8700b56d3fbb2ad4f42c06ae563a
treeb6e840c914b9b9145bd97c61917f47caa0bfc959
parent426ca38e43e4abe86ac1910cd91283d213b71285
[Messaging] Prevent crash of using released structure mail_data_final

In line 296, there is the usage:
  mail_data_final->thread_id = mail_data_final->mail_id;

but if retries loop above reaches limit, then the structure is relased,
so using it causes crash.
To prevent it, we release data on the beginning of the next iteration of
a loop.

[Verification] TCT passrate:
messaging-email - 100%.

Change-Id: I4751e5509271f28ab803e0ef10a90ff10d61ec10
src/messaging/email_manager.cc