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>