mesh: Fix segmentation fault on Join() call
authorInga Stotland <istotlan@ingas-xps13.amr.corp.intel.com>
Tue, 1 Oct 2019 18:51:08 +0000 (11:51 -0700)
committerAnupam Roy <anupam.r@samsung.com>
Tue, 17 Dec 2019 16:53:10 +0000 (22:23 +0530)
commitbd63fb8fe80ed9bca14c22a107f4be2e82b9c253
tree347f09b389af78b8a8af7312b3da3748d492ac54
parent3e88cfa44ecb6eed2d0bec31d59551b550ee566d
mesh: Fix segmentation fault on Join() call

This fixes the following segfault:

node_init_cb (node=0x0, agent=0x0) at mesh/mesh.c:359
        reply = dbus_error(join_pending->msg, MESH_ERROR_FAILED,

        user_data=0x5555555be170) at mesh/node.c:1760
        dbus=<optimized out>) at ell/dbus.c:216
        user_data=0x5555555a6e00) at ell/dbus.c:279
        user_data=0x5555555a7ef0) at ell/io.c:126
        at ell/main.c:642
        at mesh/main.c:205

The fault was caused by the premature deletion of preserved state.

This moves setup of disconnect watch for the application calling the Join()
method into the node_init_cb(), after a temporary node has been
successfully created.

Change-Id: Ib564cf87d4f09f0713b40a37bf91bff2219a30d1
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
mesh/mesh.c