X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Fnotification%2Fsrc%2Fprovider%2FNSProviderSubscription.c;h=35175e726ee942ed88bea2d03ead85f959369a37;hb=d425a2e8c8d7de6add6597d10fdd635247ff8728;hp=d2f7f9bee971b86b4f80af5346d59755329b0c7f;hpb=d5243537633f13ee80c7088d0e748df76222273b;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/notification/src/provider/NSProviderSubscription.c b/service/notification/src/provider/NSProviderSubscription.c index d2f7f9b..35175e7 100644 --- a/service/notification/src/provider/NSProviderSubscription.c +++ b/service/notification/src/provider/NSProviderSubscription.c @@ -111,7 +111,7 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour { NS_LOG(DEBUG, "NSHandleSubscription - IN"); - char * id = NSGetValueFromQuery(entityHandlerRequest->query, NS_QUERY_CONSUMER_ID); + char * id = NSGetValueFromQuery(OICStrdup(entityHandlerRequest->query), NS_QUERY_CONSUMER_ID); if(!id) { @@ -120,14 +120,14 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour return; } + NS_LOG_V(DEBUG, "consumerId = %s", id); if (resourceType == NS_RESOURCE_MESSAGE) { NS_LOG(DEBUG, "resourceType == NS_RESOURCE_MESSAGE"); NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); - OICStrcpy(subData->id, UUID_STRING_SIZE, id); - OICFree(id); + subData->id = id; subData->isWhite = false; subData->messageObId = entityHandlerRequest->obsInfo.obsId; @@ -161,8 +161,7 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); - OICStrcpy(subData->id, UUID_STRING_SIZE, id); - OICFree(id); + subData->id = id; subData->isWhite = false; subData->syncObId = entityHandlerRequest->obsInfo.obsId; @@ -189,7 +188,7 @@ void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest) { NS_LOG(DEBUG, "NSHandleUnsubscription - IN"); - char * id = NSGetValueFromQuery(entityHandlerRequest->query, NS_QUERY_CONSUMER_ID); + char * id = NSGetValueFromQuery(OICStrdup(entityHandlerRequest->query), NS_QUERY_CONSUMER_ID); if(!id) { @@ -200,7 +199,7 @@ void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest) NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); - OICStrcpy(subData->id, UUID_STRING_SIZE, id); + subData->id = id; subData->isWhite = false; subData->messageObId = entityHandlerRequest->obsInfo.obsId; @@ -217,7 +216,6 @@ void NSHandleUnsubscription(OCEntityHandlerRequest *entityHandlerRequest) NS_LOG(DEBUG, "NSHandleUnsubscription - IN"); - OICFree(id); NSFreeOCEntityHandlerRequest(entityHandlerRequest); } @@ -285,7 +283,7 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest return OC_EH_ERROR; } - char * id = NSGetValueFromQuery(entityHandlerRequest->query, NS_QUERY_CONSUMER_ID); + char * id = NSGetValueFromQuery(OICStrdup(entityHandlerRequest->query), NS_QUERY_CONSUMER_ID); if(!id) { @@ -300,8 +298,8 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest NSCacheElement * element = (NSCacheElement *) OICMalloc(sizeof(NSCacheElement)); NSCacheSubData * subData = (NSCacheSubData *) OICMalloc(sizeof(NSCacheSubData)); - OICStrcpy(subData->id, UUID_STRING_SIZE, id); - OICFree(id); + subData->id = id; + subData->isWhite = true; subData->messageObId = entityHandlerRequest->obsInfo.obsId; @@ -316,7 +314,6 @@ NSResult NSSendSubscriptionResponse(OCEntityHandlerRequest *entityHandlerRequest NSSendResponse(id, accepted); - OICFree(id); NSFreeOCEntityHandlerRequest(entityHandlerRequest); NS_LOG(DEBUG, "NSSendSubscriptionResponse - OUT");