Bug fixes for memory leak in NSProviderMemoryCache.
authorjaesick.shin <jaesick.shin@samsung.com>
Thu, 25 Aug 2016 07:20:00 +0000 (16:20 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 26 Aug 2016 06:32:31 +0000 (06:32 +0000)
Add free logic for memory leak in NSStorageWrite function.

Change-Id: Ifd8ef3b08cc61e798255be5f472df6e9d4e3575a
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10901
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
service/notification/src/provider/NSProviderMemoryCache.c

index 712aa52bedad75e281e89abaf3584c9119b0f416..710cee1a19d052e5985f6ab938122a59fd58dd61 100644 (file)
@@ -203,6 +203,8 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj)
         if (it)\r
         {\r
             NS_LOG(DEBUG, "already registered for topic name");\r
+            OICFree(topicData->topicName);\r
+            OICFree(topicData);\r
             pthread_mutex_unlock(&NSCacheMutex);\r
             return NS_FAIL;\r
         }\r
@@ -217,6 +219,8 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj)
         if (it)\r
         {\r
             NS_LOG(DEBUG, "already registered for topic name");\r
+            OICFree(topicData->topicName);\r
+            OICFree(topicData);\r
             pthread_mutex_unlock(&NSCacheMutex);\r
             return NS_FAIL;\r
         }\r
@@ -231,6 +235,8 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj)
         if (it)\r
         {\r
             NS_LOG(DEBUG, "already registered for topic name");\r
+            OICFree(topicData->topicName);\r
+            OICFree(topicData);\r
             pthread_mutex_unlock(&NSCacheMutex);\r
             return NS_FAIL;\r
         }\r