[Messaging] Prevent crash of using released structure mail_data_final 48/268548/3 submit/tizen/20220114.063030
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:52:24 +0000 (09:52 +0000)
commit97331380f399a38e1e7857e5e26a11f0bbce75c1
treefcfa071d620d01f766f6383acd10aa5ef70be469
parent02d1db1a79bd548387eeee3a9911cbafe9d45768
[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