Fix warning from static analyzer
authorjake <jaehong2.lee@samsung.com>
Thu, 2 Mar 2017 05:11:49 +0000 (14:11 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 2 Mar 2017 10:37:57 +0000 (10:37 +0000)
 - Remove unnecessary function (isdigit)
   * it is valid function when the param is char but used int param
 - Add memory free when return error.

Change-Id: I1bbecc7e88f8973340299b8393736e6fd24f1587
Signed-off-by: jake <jaehong2.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/17609
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/notification/examples/linux/notificationprovider.c
service/notification/src/consumer/NSConsumerMemoryCache.c

index 534973a..f312e12 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <ctype.h>
 
 #include "NSProviderInterface.h"
 #include "NSCommon.h"
@@ -206,7 +205,7 @@ int main()
 
         printf("input : ");
 
-        if(scanf("%d", &num) > 0 && isdigit(num) == 0)
+        if(scanf("%d", &num) > 0)
         {
             if(scanf("%c", &dummy) > 0)
             {
index a5a63e5..66a5547 100644 (file)
@@ -248,6 +248,7 @@ NSResult NSConsumerCacheWriteProvider(NSCacheList * list, NSCacheElement * newOb
     if (!obj->data)
     {
         NS_LOG (ERROR, "Failed to CopyProvider");
+        NSOICFree(obj);
         pthread_mutex_unlock(mutex);
 
         return NS_ERROR;