Fix prevent issue
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 21 Jul 2015 02:50:12 +0000 (11:50 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 21 Jul 2015 04:30:40 +0000 (13:30 +0900)
400008 Dereference null return value - flat_navi.c:debug
451475 Dereference null return value - screen_reader_system.c:tapi_init
451483 Dereference null return value - screen_reader_system.c:device_time_get
451485 Dereference null return value - screen_reader_system.c:device_date_get
451637 Structurally dead code - screen_reader_system.c:device_error_to_string

Change-Id: Ic99449307efdf315c84812005742c6b99ed873e9

src/flat_navi.c
src/screen_reader_system.c

index 6f47e84..aed47a0 100644 (file)
@@ -417,8 +417,12 @@ debug(FlatNaviContext *ctx)
          char *name = atspi_accessible_get_name(obj, NULL);
          char *role = atspi_accessible_get_role_name(obj, NULL);
          const ObjectCache *oc = object_cache_get(obj);
-         DEBUG("%d %s %s, (%d %d %d %d)", i++, name, role,
-               oc->bounds->x, oc->bounds->y, oc->bounds->width, oc->bounds->height);
+
+         if (oc)
+            DEBUG("%d %s %s, (%d %d %d %d)", i++, name, role,
+                                oc->bounds->x, oc->bounds->y,
+                       oc->bounds->width, oc->bounds->height);
+
          if (name) g_free(name);
          if (role) g_free(role);
       }
index c8e9891..78060bd 100644 (file)
@@ -29,6 +29,12 @@ static void tapi_init(void)
    int i = 0;
    char **cp_list = tel_get_cp_name_list();
 
+   if (!cp_list)
+      {
+         ERROR("cp name list is null");
+         return;
+      }
+
    DEBUG("TAPI INIT");
    for(i = 0; cp_list[i]; ++i)
       {
@@ -203,6 +209,11 @@ void device_time_get(void)
 
    time(&rawtime );
    timeinfo = localtime ( &rawtime );
+   if (!timeinfo)
+      {
+         ERROR("localtime returns NULL");
+         return;
+      }
 
    ret = vconf_get_int(VCONFKEY_REGIONFORMAT_TIME1224, &disp_12_24);
    if (ret != 0)
@@ -266,8 +277,6 @@ char *device_error_to_string(int e)
          return _("IDS_SYSTEM_NETWORK_SERVICE_UNKNOWN");
          break;
       }
-
-   return _("IDS_SYSTEM_NETWORK_SERVICE_UNKNOWN");
 }
 
 void device_battery_get(void)
@@ -621,6 +630,12 @@ void device_date_get(void)
 
    time(&rawtime );
    timeinfo = localtime ( &rawtime );
+   if (!timeinfo)
+      {
+         ERROR("localtime returns NULL");
+         return;
+      }
+
    strftime(buffer, DATE_TIME_BUFFER_SIZE, "%Y:%m:%d %H:%M:%S", timeinfo);
 
    ret = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &date_format);