Fix memory leak when returning from method on error.
authorJoseph Morrow <joseph.l.morrow@intel.com>
Wed, 18 Feb 2015 00:06:52 +0000 (19:06 -0500)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Wed, 18 Feb 2015 21:55:17 +0000 (21:55 +0000)
In ocstack.c, there was a method that could potentially malloc and then
return on error. I cleaned up this case. This fixes Rally TA5188.

Change-Id: I0ccd5259806c4e37b2ac73162f7ea0a7381fe4e7
Signed-off-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/363
Reviewed-by: Erich Keane <erich.keane@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
resource/csdk/stack/src/ocstack.c

index e2fca83..814a1b4 100644 (file)
@@ -818,6 +818,7 @@ void HandleCARequests(const CARemoteEndpoint_t* endPoint, const CARequestInfo_t*
     {
         OC_LOG(ERROR, TAG,
                 PCF("The request info numOptions is greater than MAX_HEADER_OPTIONS"));
+        OCFree(serverRequest.requestToken);
         return;
     }
     serverRequest.numRcvdVendorSpecificHeaderOptions = tempNum;