Fix segmentation fault problem after discovery.
authorWoochul Shim <woochul.shim@samsung.com>
Tue, 6 Oct 2015 00:41:44 +0000 (09:41 +0900)
committerSachin Agrawal <sachin.agrawal@intel.com>
Tue, 6 Oct 2015 13:57:12 +0000 (13:57 +0000)
commit30dbf13c6511873bd3827c8e3b90381edbc4e09e
tree10d26f05aa9dc8221491b15015718e50af47b665
parent9c16d8df074bc79dec37bc793640aa9a99910569
Fix segmentation fault problem after discovery.

- PMDeviceDiscovery() add discovered devices in the list
  whenever callback is hit. If timeout happens the pointer to a list
  could be freed by the app but still there is a registered discovery callback.
  If the callback is hit after defined timeout period, callback try to
  add a discovered device to the invalid pointer (to freed memory).
  It will cause segmentation fault.

Fix: After defined timeout, PMDeviceDiscovery() explicitly
     remove registered callback using OCCancel.

Change-Id: Ic713cefb75c3495cfc9ad6688df44eb124d88f82
Signed-off-by: Woochul Shim <woochul.shim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3545
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/security/provisioning/src/pmutility.c
resource/csdk/stack/src/ocstack.c