if (!cbNode->options)
{
OIC_LOG(ERROR, TAG, "Out of memory");
+ OICFree(cbNode);
+
return OC_STACK_NO_MEMORY;
}
memcpy(cbNode->options, options,
{
OICFree(cbNode->options);
}
+ OICFree(cbNode);
+
return OC_STACK_NO_MEMORY;
}
memcpy(cbNode->payload, payload, payloadSize);
rts[k++] = OICStrdup(rsrcType->value);
}
- return OCRepPayloadSetStringArrayAsOwner(*colPayload, OC_RSRVD_RTS, rts, dim);
+ bool b = OCRepPayloadSetStringArrayAsOwner(*colPayload, OC_RSRVD_RTS, rts, dim);
+
+ if (!b)
+ {
+ for (size_t j = 0; j < arraySize; j++)
+ {
+ OICFree(rts[j]);
+ }
+ OICFree(rts);
+ }
+
+ return b;
}
static OCStackResult SendResponse(const OCRepPayload *payload, const OCEntityHandlerRequest *ehRequest,
if (!arrayPayload[i])
{
OICFree(createdPayloadValue);
+
+ for (size_t j = 0; j < i; j++)
+ {
+ OCRepPayloadDestroy(arrayPayload[j]);
+ }
+
OICFree(arrayPayload);
+
return result;
}
if (!OCRepPayloadSetPropObjectAsOwner(arrayPayload[i], OC_RSRVD_POLICY,
addPolicyPayload((OCResourceHandle*)iterResource, devAddr)))
{
+ OICFree(createdPayloadValue);
+
+ for (size_t j = 0; j <= i; j++)
+ {
+ OCRepPayloadDestroy(arrayPayload[j]);
+ }
+
+ OICFree(arrayPayload);
+
return result;
}
else
{
char *di = OICStrdup(resource->anchor + 6);
+ VERIFY_PARAM_NON_NULL(TAG, di, "Failed to duplicating di");
+
char *slash = strchr(di, '/');
if (slash)
{
OIC_LOG_V(DEBUG, TAG, "value: %s", value);
itf[i] = OICStrdup(value);
}
- OCRepPayloadSetStringArrayAsOwner(tempPayload, OC_RSRVD_INTERFACE, itf, ifDim);
+
+ bool b = OCRepPayloadSetStringArrayAsOwner(tempPayload, OC_RSRVD_INTERFACE, itf, ifDim);
+
+ if (!b)
+ {
+ for (uint8_t i = 0; i < numElement; i++)
+ {
+ OICFree(itf[i]);
+ }
+ OICFree(itf);
+ }
}
for (OCAttribute *resAttrib = resourcePtr->rsrcAttributes; resAttrib; resAttrib = resAttrib->next)