Fix resource leak (SATIZENVUL-1629, 1630, 1632, 1633) 23/191423/4 accepted/tizen/unified/20181107.082026 submit/tizen/20181106.045243
authorCheoleun Moon <chleun.moon@samsung.com>
Wed, 17 Oct 2018 04:43:57 +0000 (13:43 +0900)
committercheoleun moon <chleun.moon@samsung.com>
Mon, 22 Oct 2018 01:41:13 +0000 (01:41 +0000)
Change-Id: I5e937d5fec56a02ef1fd7ab99949e2aa7cfa7ad2
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
packaging/capi-network-nsd.spec
src/dns-sd/dns-sd.c
src/ssdp/ssdp.c

index 7862e959a38bd70aa7bd650284354e4205420387..4b162957455a454b9ab3bef4f48569eb143480d4 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-network-nsd
 Summary:    A Network Service Discovery libraries in Native API
-Version:    0.0.22
+Version:    0.0.23
 Release:    1
 Group:      System/Network
 License:    Apache-2.0
index 70dbb09c9e53e443614b06b0702aef24b80150a9..c5d6eea601a26be67ce355b0ba4972dd76dcfb01 100644 (file)
@@ -92,15 +92,19 @@ static bool __dnssd_check_permission()
        fd = fopen("/proc/self/attr/current", "r");
        if (fd == NULL) {
                DNSSD_LOGE("Failed to open /proc/self/attr/current");
+               cynara_finish(p_cynara);
                return false;
        }
        ret = fread(smack_label, SMACK_LABEL_LEN, 1, fd);
        if (ret == 0 && ferror(fd)) {
                DNSSD_LOGE("Failed to read /proc/self/attr/current");
-               fclose(fd);
+               if (fclose(fd) != 0)
+                       DNSSD_LOGE("Failed to fclose");
+               cynara_finish(p_cynara);
                return false;
        }
-       fclose(fd);
+       if (fclose(fd) != 0)
+               DNSSD_LOGE("Failed to fclose");
 
        snprintf(uid, sizeof(uid), "%d", getuid());
 
index 00e75043532179761134051713c278432667f6e0..935dd91fb20546fa07abba69a5aa57cf6474747b 100644 (file)
@@ -168,15 +168,19 @@ static bool __ssdp_check_permission()
        fd = fopen("/proc/self/attr/current", "r");
        if (fd == NULL) {
                SSDP_LOGE("Failed to open /proc/self/attr/current");
+               cynara_finish(p_cynara);
                return false;
        }
        ret = fread(smack_label, SMACK_LABEL_LEN, 1, fd);
        if (ret == 0 && ferror(fd)) {
                SSDP_LOGE("Failed to read /proc/self/attr/current");
-               fclose(fd);
+               if (fclose(fd) != 0)
+                       SSDP_LOGE("Failed to fclose");
+               cynara_finish(p_cynara);
                return false;
        }
-       fclose(fd);
+       if (fclose(fd) != 0)
+               SSDP_LOGE("Failed to fclose");
 
        snprintf(uid, sizeof(uid), "%d", getuid());