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>
Fri, 25 Sep 2015 18:27:28 +0000 (18:27 +0000)
commit96d4834e2dc6cf926cad639bb232b8b787cb8d3e
treef804d049b4f4b2602928acfc94608c78426b3a1b
parente6a9b33034b37e116d8bca5679292fd597fcb5cd
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>
resource/csdk/stack/src/ocstack.c