[IOT-2361] Perform NULL check before dereference.
[IOT-2361] Perform NULL check before dereference.

Moved NULL checking macro invocation for pointer variable
before it gets dereferenced.

Change-Id: I303e56ae1e856991f44373e06c5adc156515107a
Signed-off-by: Senthil Kumar G S <0add671b5ee96afb9c3e97fcabc956a9e39ac5ac@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/22273
Tested-by: jenkins-iotivity <d95b56ce41a2e1ac4cecdd398defd7414407cc08@iotivity.org>
Reviewed-by: Harish Marappa <c2701d19eb0b23ed83968f56bfccca0124c2b38f@samsung.com>
Reviewed-by: Ashok Babu Channa <72ac47ef856ca3d131a57cba474ebed48591eeff@samsung.com>
(cherry picked from commit 578ba07661d943e42762745daaeeaea89fc9604e)

iotivity/iotivity,iotivity/iotivity,rzr/iotivity,rzr/iotivity,iotivity/iotivity,iotivity/iotivity,rzr/iotivity,iotivity/iotivity,rzr/iotivity,iotivity/iotivity,rzr/iotivity,rzr/iotivity,iotivity/iotivity,rzr/iotivity,iotivity/iotivity