From: Joseph Morrow Date: Wed, 18 Feb 2015 00:06:52 +0000 (-0500) Subject: Fix memory leak when returning from method on error. X-Git-Tag: 0.9.1-alpha1~38^2~167 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=226c54605407183df51b3caab3fb5b47af633f5b;p=contrib%2Fiotivity.git Fix memory leak when returning from method on error. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/363 Reviewed-by: Erich Keane Tested-by: jenkins-iotivity Reviewed-by: Doug Hudson Reviewed-by: Sudarshan Prasad --- diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index e2fca83..814a1b4 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -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;