[Messaging] Prevent crash of using released structure mail_data_final 16/268816/1 accepted/tizen/6.5/unified/20220117.134841 submit/tizen_6.5/20220113.125456
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:09 +0000 (09:04 +0000)
commit471016b01bd793304c6047835e02fa86d29a6e4e
tree1bec6b0e00c4a6e5f1089b01ffe1089055ec9089
parent5a90e95f1dbeb4bd058195d5923a3f8a8136c754
[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