Commit 421a1ca4 authored by jnashok's avatar jnashok Committed by Erich Keane

Fixing Prevent reported issues in Android Sample

Change-Id: Ifb07d72a790e8000cb5166cb0a00de03bf9b72c1
Signed-off-by: default avatarjnashok <jn.ashok@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1037Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarTim Kourt <tim.a.kourt@intel.com>
Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
parent e6c82276
......@@ -632,11 +632,10 @@ Java_org_iotivity_service_RMInterface_RMSendNotification(JNIEnv *env, jobject ob
if (CA_STATUS_OK != CACreateRemoteEndpoint((const CAURI_t) strUri,
g_selectedNwType, &endpoint))
{
LOGE("Could not create remote end point");
return;
//ReleaseStringUTFChars for strUri
(*env)->ReleaseStringUTFChars(env, uri, strUri);
LOGE("Could not create remote end point");
return;
}
char resourceURI[RESOURCE_URI_LENGTH + 1] = { 0 };
......@@ -976,25 +975,21 @@ void request_handler(const CARemoteEndpoint_t* object, const CARequestInfo_t* re
callback("Option info: ", optionInfo);
if (0 != requestInfo->info.options[i].optionData)
uint32_t optionDataLen = strlen(requestInfo->info.options[i].optionData);
char *cloneOptionData = (char *) malloc(sizeof(char) * (optionDataLen + 1));
if (NULL == cloneOptionData)
{
uint32_t optionDataLen = strlen(requestInfo->info.options[i].optionData);
char *cloneOptionData = (char *) malloc(sizeof(char) * (optionDataLen + 1));
if (NULL == cloneOptionData)
{
LOGE("cloneOptionData Out of memory");
free(g_clientEndpoint->resourceUri);
free(g_clientEndpoint);
return;
}
memcpy(cloneOptionData, requestInfo->info.options[i].optionData,
optionDataLen + 1);
callback("Option Data: ", cloneOptionData);
free(cloneOptionData);
LOGE("cloneOptionData Out of memory");
free(g_clientEndpoint->resourceUri);
free(g_clientEndpoint);
return;
}
memcpy(cloneOptionData, requestInfo->info.options[i].optionData,
optionDataLen + 1);
callback("Option Data: ", cloneOptionData);
free(cloneOptionData);
}
}
}
......@@ -1133,21 +1128,17 @@ void response_handler(const CARemoteEndpoint_t* object, const CAResponseInfo_t*
callback("Option info: ", optionInfo);
if (0 != responseInfo->info.options[i].optionData)
uint32_t optionDataLen = strlen(responseInfo->info.options[i].optionData);
char *cloneOptionData = (char *) malloc(sizeof(char) * (optionDataLen + 1));
if (NULL == cloneOptionData)
{
uint32_t optionDataLen = strlen(responseInfo->info.options[i].optionData);
char *cloneOptionData = (char *) malloc(sizeof(char) * (optionDataLen + 1));
if (NULL == cloneOptionData)
{
LOGE("cloneOptionData Out of memory");
return;
}
memcpy(cloneOptionData, responseInfo->info.options[i].optionData,
optionDataLen + 1);
callback("Option Data: ", cloneOptionData);
free(cloneOptionData);
LOGE("cloneOptionData Out of memory");
return;
}
memcpy(cloneOptionData, responseInfo->info.options[i].optionData,
optionDataLen + 1);
callback("Option Data: ", cloneOptionData);
free(cloneOptionData);
}
}
}
......
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