Correct a wrong memory free in construction of aggregate response
authorJihun Ha <jihun.ha@samsung.com>
Thu, 29 Oct 2015 09:16:40 +0000 (18:16 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Fri, 30 Oct 2015 02:28:27 +0000 (02:28 +0000)
commit8a9f7dde16d43b1795be466c6deeb60f442c148e
tree07b2d7d1f5929694084e5534fbfdf23806a382ec
parentf5a3900213bed401094a95d62defde5e4c140bdf
Correct a wrong memory free in construction of aggregate response

When an aggregate response is freed after sending it, only head response which
has a pointer of next response of the aggregate response is freed, not all
the linked responses, which might lead a wrong memory access after it.
For this reason, OCPayloadDestroy function is better to be used than
OICFree function in DeleteServerResponse function.
Additionally, I've often observed that ehResponse->payload is freed somewhere
, which the pointer becomes NULL. To overcome this exceptional situation, I
copies ehResponse->payload to a new payload data with OCRepPayloadClone
function and safely frees it when it has to be freed.

Change-Id: Ide42346b6ce4858b2587795db29b36027793a077
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3975
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
resource/csdk/stack/src/ocserverrequest.c [changed mode: 0644->0755]