Commit c22b1d43 authored by Ziran Sun's avatar Ziran Sun

Add Failure check for OCGetResourceIns() in OCRDDeleteWithDeviceId().

Bug: https://jira.iotivity.org/browse/IOT-1809
Change-Id: I1aac3d7fae0dfc5fbee4d9715b328d18bd492b14
Signed-off-by: default avatarZiran Sun <ziran.sun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20317Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarTodd Malsbary <todd.malsbary@intel.com>
Reviewed-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
parent a532ef72
......@@ -450,7 +450,8 @@ OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host,
{
OCResource *handle = (OCResource *) resourceHandles[j];
int64_t ins = 0;
OCGetResourceIns(handle, &ins);
if (OC_STACK_OK == OCGetResourceIns(handle, &ins))
{
int lenBufferRequired = snprintf((queryParam + queryLength),
(MAX_URI_LENGTH - queryLength), "&ins=%" PRId64, ins);
if (lenBufferRequired >= (MAX_URI_LENGTH - queryLength) || lenBufferRequired < 0)
......@@ -460,6 +461,7 @@ OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host,
queryLength += lenBufferRequired;
OIC_LOG_V(DEBUG, TAG, "queryParam [%s]", queryParam);
}
}
if (targetUriBufferRequired + queryLength + 1 > MAX_URI_LENGTH)
{
......
......@@ -5997,13 +5997,19 @@ OCStackResult OCUpdateResourceInsWithResponse(const char *requestUri,
if (resHandle)
{
int64_t resIns = 0;
OCGetResourceIns(resHandle, &resIns);
if (OC_STACK_OK == OCGetResourceIns(resHandle, &resIns))
{
if (queryIns && queryIns == resIns)
{
OCBindResourceInsToResource(resHandle, 0);
break;
}
}
else
{
OIC_LOG(ERROR, TAG, "Get resource instance failed!");
}
}
}
}
start = strtok_r(NULL, token, &iterTokenPtr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment