shared/gatt-client: Fix freeing instance while processing notification
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 25 Jun 2020 20:52:55 +0000 (13:52 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
commit788aab98d65b1cecbed42eec24631babc457e8ab
tree00b217919dfdb98c8bfe45e47a7da01b14380322
parent100b4e7436ac90e3ad4f11c92cc8e583f9e5665e
shared/gatt-client: Fix freeing instance while processing notification

If CCC fails to be programmed the callback would be run without taking
a reference which may lead to freeing the client instance while there
are still notification to be processed.

To fix this handling of both success and failure to program the CCC will
now take a reference to the client, also in case of failure instead of
attempting to program the CCC once again the code now notify all the
queued requests which is consistent with how the success case is
handled.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/shared/gatt-client.c