- Be used OICFree without NULL checking.
Change-Id: I1ce65d0e41a3b9f276a2b517d7b3d1c06faa92e6
Signed-off-by: jake <jaehong2.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18239
Reviewed-by: JungYong KIM <jyong2.kim@samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
NSSubscribeRequestCb(consumer);\r
}\r
\r
- OICFree(copyQuery);\r
+ NSOICFree(copyQuery);\r
NSFreeConsumer(consumer);\r
NSFreeOCEntityHandlerRequest(request);\r
\r
NS_LOG(DEBUG, "No Task Type");\r
break;\r
}\r
- OICFree(node);\r
+ NSOICFree(node);\r
}\r
\r
pthread_mutex_unlock(&NSMutex[CALLBACK_RESPONSE_SCHEDULER]);\r
break;\r
}\r
\r
- OICFree(node);\r
+ NSOICFree(node);\r
}\r
\r
pthread_mutex_unlock(&NSMutex[DISCOVERY_SCHEDULER]);\r
NSPushQueue(TOPIC_SCHEDULER, TAST_GET_CONSUMER_TOPICS, &topicSync);
pthread_cond_wait(topicSync.condition, &nsInitMutex);
- OICFree(topicSync.consumerId);
+ NSOICFree(topicSync.consumerId);
pthread_mutex_unlock(&nsInitMutex);
NS_LOG(DEBUG, "NSProviderGetConsumerTopics - OUT");
pthread_mutex_unlock(&nsInitMutex);
return NS_FAIL;
}
- OICFree(topicSyncResult.topicData);
+ NSOICFree(topicSyncResult.topicData);
pthread_mutex_unlock(&nsInitMutex);
NS_LOG(DEBUG, "NSProviderDeleteTopics - OUT");
&& strcmp(reqInterface, NS_INTERFACE_READ) != 0)\r
{\r
NS_LOG(ERROR, "Invalid interface");\r
- OICFree(copyQuery);\r
+ NSOICFree(copyQuery);\r
return ehResult;\r
}\r
\r
- OICFree(copyQuery);\r
+ NSOICFree(copyQuery);\r
NSPushQueue(SUBSCRIPTION_SCHEDULER, TASK_SEND_POLICY,\r
NSCopyOCEntityHandlerRequest(entityHandlerRequest));\r
\r
\r
char * copyQuery = OICStrdup(entityHandlerRequest->query);\r
reqInterface = OICStrdup(NSGetValueFromQuery(copyQuery, NS_QUERY_INTERFACE));\r
- OICFree(copyQuery);\r
+ NSOICFree(copyQuery);\r
\r
if (reqInterface && strcmp(reqInterface, NS_INTERFACE_BASELINE) != 0\r
&& strcmp(reqInterface, NS_INTERFACE_READ) != 0)\r
\r
ehResult = NSProviderSendResponse(entityHandlerRequest, payload, reqInterface, ehResult,\r
NS_INTERFACE_TYPE_READ, NS_RESOURCE_MESSAGE);\r
- OICFree(reqInterface);\r
+ NSOICFree(reqInterface);\r
NS_LOG(DEBUG, "NSEntityHandlerMessageCb - OUT");\r
return ehResult;\r
}\r
\r
char * copyQuery = OICStrdup(entityHandlerRequest->query);\r
reqInterface = OICStrdup(NSGetValueFromQuery(copyQuery, NS_QUERY_INTERFACE));\r
- OICFree(copyQuery);\r
+ NSOICFree(copyQuery);\r
\r
if (reqInterface && strcmp(reqInterface, NS_INTERFACE_BASELINE) != 0\r
&& strcmp(reqInterface, NS_INTERFACE_READWRITE) != 0)\r
\r
ehResult = NSProviderSendResponse(entityHandlerRequest, payload, reqInterface, ehResult,\r
NS_INTERFACE_TYPE_READ, NS_RESOURCE_MESSAGE);\r
- OICFree(reqInterface);\r
+ NSOICFree(reqInterface);\r
\r
return ehResult;\r
}\r
\r
char * copyReq = OICStrdup(entityHandlerRequest->query);\r
reqInterface = OICStrdup(NSGetValueFromQuery(copyReq, NS_QUERY_INTERFACE));\r
- OICFree(copyReq);\r
+ NSOICFree(copyReq);\r
\r
if (reqInterface && strcmp(reqInterface, NS_INTERFACE_BASELINE) != 0\r
&& strcmp(reqInterface, NS_INTERFACE_READWRITE) != 0)\r
NS_LOG(DEBUG, "NSEntityHandlerTopicCb - OUT");\r
ehResult = NSProviderSendResponse(entityHandlerRequest, payload, reqInterface, ehResult,\r
NS_INTERFACE_TYPE_READWRITE, NS_RESOURCE_TOPIC);\r
- OICFree(reqInterface);\r
+ NSOICFree(reqInterface);\r
return ehResult;\r
}\r
\r
NSSyncInfo * syncInfo = (NSSyncInfo *)OICMalloc(sizeof(NSSyncInfo));\r
syncInfo->state = (type == NS_MESSAGE_READ) ? NS_SYNC_READ : NS_SYNC_DELETED;\r
OICStrcpy(syncInfo->providerId, NS_UUID_STRING_SIZE, pId);\r
- OICFree(pId);\r
+ NSOICFree(pId);\r
NSPushQueue(NOTIFICATION_SCHEDULER, TASK_RECV_READ, (void*) syncInfo);\r
}\r
}\r
if (it) \\r
{ \\r
NS_LOG(DEBUG, "already registered for topic name"); \\r
- OICFree(topicData->topicName); \\r
- OICFree(topicData); \\r
- OICFree(newObj); \\r
+ NSOICFree(topicData->topicName); \\r
+ NSOICFree(topicData); \\r
+ NSOICFree(newObj); \\r
pthread_mutex_unlock(&NSCacheMutex); \\r
return NS_FAIL; \\r
} \\r
}\r
\r
NS_LOG(DEBUG, "Update Data - OUT");\r
- OICFree(subData);\r
- OICFree(newObj);\r
+ NSOICFree(subData);\r
+ NSOICFree(newObj);\r
pthread_mutex_unlock(&NSCacheMutex);\r
return NS_OK;\r
}\r
{\r
next = (NSCacheElement *) iter->next;\r
NSProviderDeleteCacheData(type, iter->data);\r
- OICFree(iter);\r
+ NSOICFree(iter);\r
iter = next;\r
}\r
\r
- OICFree(list);\r
+ NSOICFree(list);\r
return NS_OK;\r
}\r
\r
NSCacheSubData * subData = (NSCacheSubData *) data;\r
\r
(subData->id)[0] = '\0';\r
- OICFree(subData);\r
+ NSOICFree(subData);\r
return NS_OK;\r
}\r
else if (type == NS_PROVIDER_CACHE_REGISTER_TOPIC)\r
NS_LOG_V(DEBUG, "topicData->topicName = %s, topicData->state = %d", topicData->topicName,\r
(int)topicData->state);\r
\r
- OICFree(topicData->topicName);\r
- OICFree(topicData);\r
+ NSOICFree(topicData->topicName);\r
+ NSOICFree(topicData);\r
}\r
else if (type == NS_PROVIDER_CACHE_CONSUMER_TOPIC_NAME ||\r
type == NS_PROVIDER_CACHE_CONSUMER_TOPIC_CID)\r
{\r
NSCacheTopicSubData * topicData = (NSCacheTopicSubData *) data;\r
- OICFree(topicData->topicName);\r
- OICFree(topicData);\r
+ NSOICFree(topicData->topicName);\r
+ NSOICFree(topicData);\r
}\r
\r
return NS_OK;\r
\r
list->head = del->next;\r
NSProviderDeleteCacheData(type, del->data);\r
- OICFree(del);\r
+ NSOICFree(del);\r
pthread_mutex_unlock(&NSCacheMutex);\r
return NS_OK;\r
}\r
\r
prev->next = del->next;\r
NSProviderDeleteCacheData(type, del->data);\r
- OICFree(del);\r
+ NSOICFree(del);\r
pthread_mutex_unlock(&NSCacheMutex);\r
return NS_OK;\r
}\r
\r
conTopicList->head = del->next;\r
NSProviderDeleteCacheData(type, del->data);\r
- OICFree(del);\r
+ NSOICFree(del);\r
pthread_mutex_unlock(&NSCacheMutex);\r
return NS_OK;\r
}\r
\r
prev->next = del->next;\r
NSProviderDeleteCacheData(type, del->data);\r
- OICFree(del);\r
+ NSOICFree(del);\r
pthread_mutex_unlock(&NSCacheMutex);\r
return NS_OK;\r
}\r
break;
}
- OICFree(node);
+ NSOICFree(node);
}
pthread_mutex_unlock(&NSMutex[NOTIFICATION_SCHEDULER]);
NSTask* temp = NSHeadMsg[i];\r
NSHeadMsg[i] = NSHeadMsg[i]->nextTask;\r
NSFreeData(i, temp);\r
- OICFree(temp);\r
+ NSOICFree(temp);\r
}\r
\r
NSTailMsg[i] = NSHeadMsg[i] = NULL;\r
case TASK_UNSUBSCRIBE_TOPIC:\r
{\r
NSCacheTopicSubData * data = task->taskData;\r
- OICFree(data->topicName);\r
- OICFree(data);\r
+ NSOICFree(data->topicName);\r
+ NSOICFree(data);\r
}\r
break;\r
case TASK_REGISTER_TOPIC:\r
case TASK_UNREGISTER_TOPIC:\r
{\r
- OICFree(task->taskData);\r
+ NSOICFree(task->taskData);\r
}\r
break;\r
case TASK_SEND_TOPICS:\r
OCResourcePayloadAddStringLL(&payload->types, NS_ROOT_TYPE);\r
}\r
\r
- OICFree(copyReq);\r
+ NSOICFree(copyReq);\r
OCRepPayloadSetUri(payload, NS_ROOT_URI);\r
OCRepPayloadSetPropString(payload, NS_ATTRIBUTE_PROVIDER_ID, NSGetProviderInfo()->providerId);\r
OCRepPayloadSetPropString(payload, NS_ATTRIBUTE_VERSION, VERSION);\r
\r
if (!id)\r
{\r
- OICFree(copyReq);\r
+ NSOICFree(copyReq);\r
NSFreeOCEntityHandlerRequest(entityHandlerRequest);\r
NS_LOG(ERROR, "Invalid ConsumerID");\r
return;\r
\r
NSFreeOCEntityHandlerRequest(entityHandlerRequest);\r
}\r
- OICFree(copyReq);\r
+ NSOICFree(copyReq);\r
\r
NS_LOG(DEBUG, "NSHandleSubscription - OUT");\r
}\r
\r
if (!id)\r
{\r
- OICFree(copyReq);\r
+ NSOICFree(copyReq);\r
NSFreeOCEntityHandlerRequest(entityHandlerRequest);\r
NS_LOG(ERROR, "Invalid ConsumerID");\r
return NS_ERROR;\r
\r
NSCacheUpdateSubScriptionState(consumerSubList, id, true);\r
NSSendResponse(id, true);\r
- OICFree(copyReq);\r
+ NSOICFree(copyReq);\r
NSFreeOCEntityHandlerRequest(entityHandlerRequest);\r
NS_LOG(DEBUG, "NSSendSubscriptionResponse - OUT");\r
return NS_OK;\r
OCCallbackData cbdata = { NULL, NULL, NULL };\r
cbdata.cb = NSProviderGetMQResponseCB;\r
cbdata.context = OICStrdup(topicName);\r
- cbdata.cd = OICFree;\r
+ cbdata.cd = NSOICFree;\r
\r
char requestUri[100] = "coap+tcp://";\r
\r
\r
NSOCResultToSuccess(ret);\r
\r
- OICFree(topicAddr->serverAddr);\r
- OICFree(topicAddr->topicName);\r
- OICFree(topicAddr);\r
+ NSOICFree(topicAddr->serverAddr);\r
+ NSOICFree(topicAddr->topicName);\r
+ NSOICFree(topicAddr);\r
}\r
#endif\r
\r
\r
NSCacheUpdateSubScriptionState(consumerSubList, consumerId, true);\r
NSSendResponse(consumerId, true);\r
- OICFree(consumerId);\r
+ NSOICFree(consumerId);\r
break;\r
}\r
case TASK_SEND_DENY:\r
\r
NSCacheUpdateSubScriptionState(consumerSubList, consumerId, false);\r
NSSendResponse(consumerId, false);\r
- OICFree(consumerId);\r
+ NSOICFree(consumerId);\r
\r
break;\r
}\r
break;\r
\r
}\r
- OICFree(node);\r
+ NSOICFree(node);\r
}\r
\r
pthread_mutex_unlock(&NSMutex[SUBSCRIPTION_SCHEDULER]);\r
\r
if (providerInfo->providerName)\r
{\r
- OICFree(providerInfo->providerName);\r
+ NSOICFree(providerInfo->providerName);\r
providerInfo->providerName = NULL;\r
}\r
\r
if (providerInfo->userInfo)\r
{\r
- OICFree(providerInfo->userInfo);\r
+ NSOICFree(providerInfo->userInfo);\r
providerInfo->userInfo = NULL;\r
}\r
\r
- OICFree(providerInfo);\r
+ NSOICFree(providerInfo);\r
providerInfo = NULL;\r
}\r
\r
NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement));
if (!element)
{
- OICFree(data->topicName);
- OICFree(data);
+ NSOICFree(data->topicName);
+ NSOICFree(data);
return NS_FAIL;
}
if (!payload)
{
NS_LOG(ERROR, "payload is NULL");
- OICFree(copyReq);
+ NSOICFree(copyReq);
return NS_ERROR;
}
OCRepPayloadSetPropString(payload, NS_ATTRIBUTE_CONSUMER_ID, id);
}
OCRepPayloadSetPropString(payload, NS_ATTRIBUTE_PROVIDER_ID, NSGetProviderInfo()->providerId);
- OICFree(copyReq);
+ NSOICFree(copyReq);
if (topics)
{
(int) topics->state);
NSTopicLL * next = topics->next;
- OICFree(topics->topicName);
- OICFree(topics);
+ NSOICFree(topics->topicName);
+ NSOICFree(topics);
topics = next;
}
{
OCRepPayloadDestroy(payloadTopicArray[i]);
}
- OICFree(payloadTopicArray);
+ NSOICFree(payloadTopicArray);
}
else
{
OCResourcePayloadAddStringLL(&payload->types, NS_ROOT_TYPE);
}
- OICFree(copyReq);
+ NSOICFree(copyReq);
response.requestHandle = entityHandlerRequest->requestHandle;
response.resourceHandle = entityHandlerRequest->resource;
response.persistentBufferFlag = 0;
if (!newObj)
{
- OICFree(topicSubData->topicName);
- OICFree(topicSubData);
- OICFree(consumerId);
+ NSOICFree(topicSubData->topicName);
+ NSOICFree(topicSubData);
+ NSOICFree(consumerId);
return NS_FAIL;
}
}
}
NSSendTopicUpdationToConsumer(consumerId);
- OICFree(consumerId);
+ NSOICFree(consumerId);
NS_LOG(DEBUG, "NSPostConsumerTopics() - OUT");
return NS_OK;
}
(NSCacheTopicSubData *) topicSyncResult->topicData;
if (!newObj)
{
- OICFree(subData->topicName);
- OICFree(subData);
+ NSOICFree(subData->topicName);
+ NSOICFree(subData);
pthread_cond_signal(topicSyncResult->condition);
pthread_mutex_unlock(topicSyncResult->mutex);
}
}
else
{
- OICFree(subData->topicName);
- OICFree(subData);
- OICFree(newObj);
+ NSOICFree(subData->topicName);
+ NSOICFree(subData);
+ NSOICFree(newObj);
}
}
pthread_cond_signal(topicSyncResult->condition);
topicSyncResult->result = NS_OK;
}
- OICFree(topicSubData->topicName);
- OICFree(topicSubData);
+ NSOICFree(topicSubData->topicName);
+ NSOICFree(topicSubData);
pthread_cond_signal(topicSyncResult->condition);
pthread_mutex_unlock(topicSyncResult->mutex);
break;
}
- OICFree(node);
+ NSOICFree(node);
}
pthread_mutex_unlock(&NSMutex[TOPIC_SCHEDULER]);