Fixed codes which may occur potential bugs. 27/75727/4 accepted/tizen/common/20160627.192304 accepted/tizen/ivi/20160628.014957 accepted/tizen/mobile/20160628.015021 accepted/tizen/tv/20160628.014932 accepted/tizen/wearable/20160628.015019 submit/tizen/20160627.120129
authorshingil.kang <shingil.kang@samsung.com>
Tue, 21 Jun 2016 06:47:18 +0000 (15:47 +0900)
committershingil.kang <shingil.kang@samsung.com>
Tue, 21 Jun 2016 10:33:50 +0000 (19:33 +0900)
- check null pointer
- fix double close

Change-Id: I7baacb4d01d74a883ef969e43a14035ee89307a1
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
src/properties.c
src/services.c

index dc76a69..1127655 100644 (file)
@@ -69,16 +69,17 @@ static void property_init(void)
         if(read_line(fd, buffer, PROPERTY_KEY_MAX+PROPERTY_VALUE_MAX+1) < 0)
             break;
         tok = strtok_r(buffer, PROPERTY_SEPARATOR, &ptr);
-        for (i = 0; i < sdbd_config_element_cnt && sdbd_config[i].key ; i++) {
-            if (!strcmp(tok, sdbd_config[i].key)) {
-                tok = strtok_r(NULL, PROPERTY_SEPARATOR, &ptr);
-                if(tok) {
-                    snprintf(sdbd_config[i].value, PROPERTY_VALUE_MAX, "%s", tok);
-                    D("property init key=%s, value=%s\n", sdbd_config[i].key, tok);
+        if(tok) {
+            for (i = 0; i < sdbd_config_element_cnt && sdbd_config[i].key ; i++) {
+                if (!strcmp(tok, sdbd_config[i].key)) {
+                    tok = strtok_r(NULL, PROPERTY_SEPARATOR, &ptr);
+                    if(tok) {
+                        snprintf(sdbd_config[i].value, PROPERTY_VALUE_MAX, "%s", tok);
+                        D("property init key=%s, value=%s\n", sdbd_config[i].key, tok);
+                    }
                 }
             }
         }
-
     }
     sdb_close(fd);
     D("called property_init\n");
index 33c5c76..e2b5928 100644 (file)
@@ -782,7 +782,6 @@ static int create_sync_subprocess(void (*func)(int, void *), void* cookie) {
     if(sdb_thread_create( &t, service_bootstrap_func, sti)){
         free(sti);
         sdb_close(s[0]);
-        sdb_close(s[1]);
         printf("cannot create service monitor thread\n");
         return -1;
     }