Fix segfault when calling OCCancel ()
authorMandeep Shetty <mandeep.shetty@intel.com>
Thu, 24 Sep 2015 20:42:39 +0000 (13:42 -0700)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Mon, 28 Sep 2015 16:49:14 +0000 (16:49 +0000)
commitd38ca5a5eeff36c930670d7075c144891920c9bb
treeade52c226e3bda762c6c5f10a4de783af5119fbd
parenta256c82f8798d90e3c44ec515f7c6d35e87316b2
Fix segfault when calling OCCancel ()

This fixes the client side crash in IOT-733.
OCCancel () allocates a pointer that is free'd in routingutility.c.
Although the pointer was passed in as reference into routingutility and
is re-assigned with a new malloc'ed pointer, OCCancel() free's the old
pointer.
This is because there two structs that are being passed around. The
pointer that is double free'd is free'd twice as part of two DIFFERENT
structs. Got rid of the extra struct to keep things consistent and
resolve the crash.

If accepted, this changeset should be cherrypicked to 1.0.0-dev.

Change-Id: I8c961776406c02dbe7706a787bb19db53ba83853
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3055
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
(cherry picked from commit 96d4834e2dc6cf926cad639bb232b8b787cb8d3e)
Reviewed-on: https://gerrit.iotivity.org/gerrit/3141
resource/csdk/stack/src/ocstack.c