mesh: Fix to send close indication on timeout
authorPrathyusha N <prathyusha.n@samsung.com>
Tue, 3 Dec 2019 10:01:25 +0000 (15:31 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Tue, 17 Dec 2019 20:50:55 +0000 (02:20 +0530)
If pb_session is freed in timeout, close indication will not be sent.
pb_session is freed in pb_adv_unreg() and hence removed from tx_timeout.
Added acceptor_free() in acp_prov_close() to ensure pb_session is freed.

Change-Id: I4649bfa038cf14fb613f13c6b910314f7f710403
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
mesh/pb-adv.c
mesh/prov-acceptor.c

index 19d1453..586cd7f 100644 (file)
@@ -175,8 +175,6 @@ static void tx_timeout(struct l_timeout *timeout, void *user_data)
        l_info("TX timeout");
        cb = pb_session->close_cb;
        user_data = pb_session->user_data;
-       l_free(pb_session);
-       pb_session = NULL;
        cb(user_data, 1);
 }
 
index 57eb1e7..24ff5a9 100644 (file)
@@ -121,6 +121,7 @@ static void acceptor_free(void)
 static void acp_prov_close(void *user_data, uint8_t reason)
 {
        /* TODO: Handle Close */
+       acceptor_free();
 }
 
 static void prov_to(struct l_timeout *timeout, void *user_data)