Fix for IOT-613 issue.
authorsonu1.yadav <sonu1.yadav@samsung.com>
Thu, 16 Jul 2015 07:09:44 +0000 (12:39 +0530)
committerErich Keane <erich.keane@intel.com>
Fri, 17 Jul 2015 17:34:35 +0000 (17:34 +0000)
Problem: When SIGINT signal is raised, occlient called OCStop(). OCStop() function called deleteResource() to delete the resources. deleteResource() takes OCResource* as first argument and dont check the NULL value.

Fix: Null check for argument in deleteResource().

Change-Id: I1f71bc5f90ef7199bf33da7157c8e52d2ffe94dd
Signed-off-by: sonu1.yadav <sonu1.yadav@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1687
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Omkar Hegde <omkar.m.hegde@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/src/ocstack.c

index ab31608..44b1e65 100644 (file)
@@ -3375,6 +3375,11 @@ OCStackResult deleteResource(OCResource *resource)
 {
     OCResource *prev = NULL;
     OCResource *temp = NULL;
+    if(!resource)
+    {
+        OC_LOG_V(DEBUG,TAG,"resource is NULL");
+        return OC_STACK_INVALID_PARAM;
+    }
 
     OC_LOG_V (INFO, TAG, "Deleting resource %s", resource->uri);