[Messaging] Prevent crash of using released structure mail_data_final 18/268818/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:36 +0000 (09:04 +0000)
commitf7ee7823b9778b7832f729658bb2dc5fa9bb3e13
tree5fc6283a64d35de17613f1753911c04116687137
parent291a3d352c9da019b9f8ab4e8e265c6376e7d6ff
[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