From: jaesick.shin Date: Fri, 22 Jul 2016 07:51:44 +0000 (+0900) Subject: Fix bugs about memory free at Notification scheduler, and don't initialize observe... X-Git-Tag: 1.2.0+RC1~52^2~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26eb7ee5bbd02822ee8924d3ddb57ad4de125a94;p=platform%2Fupstream%2Fiotivity.git Fix bugs about memory free at Notification scheduler, and don't initialize observe id in NSProviderSubscription. This commit included bug fixed. 1. double freeing of memory int stopscheduler function. 2. The code has been cleared from the prevous commit. added initialize code of observeid. second, third patch included delete not required header and add required header. Change-Id: I56b330ef99f6ef6b57c81afd0e75e25dfaf5306b Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/9605 Reviewed-by: Uze Choi Tested-by: Uze Choi --- diff --git a/service/notification/android/notification-service/src/main/jni/notificationProvider.h b/service/notification/android/notification-service/src/main/jni/notificationProvider.h index 9d6a057..13787e1 100644 --- a/service/notification/android/notification-service/src/main/jni/notificationProvider.h +++ b/service/notification/android/notification-service/src/main/jni/notificationProvider.h @@ -20,7 +20,7 @@ #include -#include "NSProvider.h" +#include "NSProviderInterface.h" #include "NSCommon.h" #ifndef NOTIFICATION_JNI_H diff --git a/service/notification/include/NSCommon.h b/service/notification/include/NSCommon.h index 41beb5d..e11fa79 100644 --- a/service/notification/include/NSCommon.h +++ b/service/notification/include/NSCommon.h @@ -44,6 +44,8 @@ #define NS_ATTRIBUTE_DATETIME "DATE_TIME" #define NS_ATTRIBUTE_TTL "TTL" +#include + /** * Result code of notification service */ diff --git a/service/notification/src/common/NSStructs.h b/service/notification/src/common/NSStructs.h index 47e30ed..80c6706 100644 --- a/service/notification/src/common/NSStructs.h +++ b/service/notification/src/common/NSStructs.h @@ -28,6 +28,7 @@ #include #include "NSCommon.h" #include "NSConstants.h" +#include "ocstack.h" typedef struct _nsTask { diff --git a/service/notification/src/provider/NSProviderScheduler.c b/service/notification/src/provider/NSProviderScheduler.c index 9e9173f..64032be 100755 --- a/service/notification/src/provider/NSProviderScheduler.c +++ b/service/notification/src/provider/NSProviderScheduler.c @@ -125,11 +125,10 @@ bool NSStopScheduler() { NSTask* temp = NSHeadMsg[i]; NSHeadMsg[i] = NSHeadMsg[i]->nextTask; - NSFreeData(i, NSHeadMsg[i]); + NSFreeData(i, temp); OICFree(temp); } - OICFree(NSHeadMsg[i]); NSTailMsg[i] = NSHeadMsg[i] = NULL; pthread_mutex_unlock(&NSMutex[i]); diff --git a/service/notification/src/provider/NSProviderSubscription.c b/service/notification/src/provider/NSProviderSubscription.c index 8ea355a..bb8d742 100644 --- a/service/notification/src/provider/NSProviderSubscription.c +++ b/service/notification/src/provider/NSProviderSubscription.c @@ -137,15 +137,19 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour { NS_LOG(DEBUG, "Requested by remote server"); subData->remote_messageObId = entityHandlerRequest->obsInfo.obsId; + subData->messageObId = 0; NS_LOG_V(DEBUG, "SubList message observation ID = [%d]", subData->remote_messageObId); } else { NS_LOG(DEBUG, "Requested by local consumer"); subData->messageObId = entityHandlerRequest->obsInfo.obsId; + subData->remote_messageObId = 0; NS_LOG_V(DEBUG, "SubList message observation ID = [%d]", subData->messageObId); } subData->isWhite = false; + subData->remote_syncObId = 0; + subData->syncObId = 0; element->data = (void*) subData; element->next = NULL; @@ -180,16 +184,20 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour { NS_LOG(DEBUG, "Requested by remote server"); subData->remote_syncObId = entityHandlerRequest->obsInfo.obsId; + subData->syncObId = 0; NS_LOG_V(DEBUG, "SubList sync observation ID = [%d]", subData->remote_syncObId); } else { NS_LOG(DEBUG, "Requested by local consumer"); subData->syncObId = entityHandlerRequest->obsInfo.obsId; + subData->remote_syncObId = 0; NS_LOG_V(DEBUG, "SubList sync observation ID = [%d]", subData->syncObId); } subData->isWhite = false; + subData->messageObId = 0; + subData->remote_messageObId = 0; element->data = (void*) subData; element->next = NULL;