X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fstack%2Fsrc%2Foccollection.c;h=66b5dce9e2749662a664ef00ace13de495c1feef;hb=refs%2Ftags%2Faccepted%2Ftizen%2Funified%2F20171010.063815;hp=aafb5ab51295553d9fe7af813d37066b7496a6ed;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/stack/src/occollection.c b/resource/csdk/stack/src/occollection.c index aafb5ab..66b5dce 100755 --- a/resource/csdk/stack/src/occollection.c +++ b/resource/csdk/stack/src/occollection.c @@ -48,6 +48,7 @@ static bool AddRTSBaslinePayload(OCRepPayload **linkArray, int size, OCRepPayloa { OICFree(rt[l]); } + OICFree(rt); } for (OCStringLL *rsrcType = (*colPayload)->types; rsrcType; rsrcType = rsrcType->next, arraySize++); @@ -71,6 +72,7 @@ static bool AddRTSBaslinePayload(OCRepPayload **linkArray, int size, OCRepPayloa rts[k++] = OICStrdup(rt[l]); OICFree(rt[l]); } + OICFree(rt); } for (OCStringLL *rsrcType = (*colPayload)->types; rsrcType; rsrcType = rsrcType->next, size++) { @@ -173,7 +175,7 @@ exit: } ret = SendResponse(colPayload, ehRequest, collResource, ehResult); OIC_LOG_PAYLOAD(DEBUG, (OCPayload *)colPayload); - + OCRepPayloadDestroy(colPayload); return ret; } @@ -186,16 +188,14 @@ static OCStackResult HandleBatchInterface(OCEntityHandlerRequest *ehRequest) OCStackResult stackRet = OC_STACK_OK; char *storeQuery = NULL; - OCRepPayload *payload = OCRepPayloadCreate(); OCResource *collResource = (OCResource *)ehRequest->resource; - VERIFY_PARAM_NON_NULL(TAG, payload, "Failed creating RepPayload"); if (stackRet == OC_STACK_OK) { if (collResource->rsrcChildResourcesHead) { - storeQuery = OICStrdup(ehRequest->query); + storeQuery = ehRequest->query; ehRequest->query = NULL; OIC_LOG_V(DEBUG, TAG, "Query : %s", ehRequest->query); } @@ -240,12 +240,8 @@ static OCStackResult HandleBatchInterface(OCEntityHandlerRequest *ehRequest) } ehRequest->resource = (OCResourceHandle) collResource; } - ehRequest->query = OICStrdup(storeQuery); - OICFree(storeQuery); + ehRequest->query = storeQuery; return stackRet; -exit: - OICFree(storeQuery); - return OC_STACK_NO_MEMORY; } OCStackResult DefaultCollectionEntityHandler(OCEntityHandlerFlag flag, OCEntityHandlerRequest *ehRequest) @@ -273,6 +269,9 @@ OCStackResult DefaultCollectionEntityHandler(OCEntityHandlerFlag flag, OCEntityH { ifQueryParam = OICStrdup(OC_RSRVD_INTERFACE_LL); } + + VERIFY_PARAM_NON_NULL(TAG, ifQueryParam, "Invalid Parameter root"); + if (0 == strcmp(ifQueryParam, OC_RSRVD_INTERFACE_LL) || 0 == strcmp (ifQueryParam, OC_RSRVD_INTERFACE_DEFAULT)) { if (ehRequest->method == OC_REST_PUT || ehRequest->method == OC_REST_POST)