Fix deadcode execution in ocserverrequest.c
authorHabib Virji <habib.virji@samsung.com>
Fri, 9 Dec 2016 18:39:35 +0000 (18:39 +0000)
committerZiran Sun <ziran.sun@samsung.com>
Tue, 13 Dec 2016 11:34:01 +0000 (11:34 +0000)
There was a deadcode.

It has goto statement which is only called when memory allocation fails.

In the goto statement, it was trying to free the variable that failed in memory allocation.

BUG: https://jira.iotivity.org/browse/IOT-1664
Change-Id: I36ea779ee5bae131a10f55dafcb45728c1e7dc9b
Signed-off-by: Habib Virji <habib.virji@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15373
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: George Nash <george.nash@intel.com>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
resource/csdk/stack/src/ocserverrequest.c

index ee79607..cfab244 100644 (file)
@@ -97,11 +97,6 @@ static OCStackResult AddServerResponse (OCServerResponse ** response, OCRequestH
     return OC_STACK_OK;
 
 exit:
-    if (serverResponse)
-    {
-        OICFree(serverResponse);
-        serverResponse = NULL;
-    }
     *response = NULL;
     return OC_STACK_NO_MEMORY;
 }