In case if pointer has not been assigned
This is also suppressing a valgrind warning
when running test resource/csdk/stack/test/stacktests:
2,208 bytes in 1 blocks \
are possibly lost in loss record 0 if 0
Bug: https://jira.iotivity.org/browse/IOT-2645
Change-Id: Ifd44172a1f7755ec253748f6f02fbfd1dcacdd39
Origin: https://gerrit.iotivity.org/gerrit/#/c/22107/
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/22107
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: George Nash <george.nash@intel.com>
Reviewed-by: Mats Wichmann <mats@linux.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
(cherry picked from commit
2c926be5e04dd982316c05c461c9a95fd0beae9a)
}
exit:
- for (size_t i = 0; i < dimensions[0]; i++)
+ if (links)
{
- OCRepPayloadDestroy(links[i]);
+ for (size_t i = 0; i < dimensions[0]; i++)
+ {
+ OCRepPayloadDestroy(links[i]);
+ }
+ OICFree(links);
}
- OICFree(links);
return cbData->cb(cbData->context, handle, clientResponse);
}