coverity fix 26/213226/1
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Tue, 3 Sep 2019 05:17:21 +0000 (14:17 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Tue, 3 Sep 2019 05:17:29 +0000 (14:17 +0900)
Change-Id: Ic355e6fb4419394a443e995875cd818850a4a2c5
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
plugins/iot/display/core.c
plugins/mobile/display/core.c
plugins/tv/display/core.c
plugins/wearable/display/core.c
src/display/display-dbus.c
src/ir/ir.c

index 87ceda1..a93cf4b 100644 (file)
@@ -2809,10 +2809,12 @@ static void display_init(void *data)
                        _I("Start Power managing without noti");
                        if (power_ops.get_power_lock_support()) {
                                broadcast_pm_wakeup();
-                       power_ops.power_lock();
+                               power_ops.power_lock();
                        }
                        pm_cur_state = S_NORMAL;
-                       vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       ret = vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       if (ret < 0)
+                               _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
 
                        status = DEVICE_OPS_STATUS_START;
                        if (display_conf.timeout_enable) {
index 30ca2bd..820aa9e 100644 (file)
@@ -2824,7 +2824,9 @@ static void display_init(void *data)
                                power_ops.power_lock();
                        }
                        pm_cur_state = S_NORMAL;
-                       vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       ret = vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       if (ret < 0)
+                               _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
 
                        status = DEVICE_OPS_STATUS_START;
                        if (display_conf.timeout_enable) {
index dbd6954..0fa9df0 100644 (file)
@@ -2812,7 +2812,9 @@ static void display_init(void *data)
                                power_ops.power_lock();
                        }
                        pm_cur_state = S_NORMAL;
-                       vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       ret = vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       if (ret < 0)
+                               _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
 
                        status = DEVICE_OPS_STATUS_START;
                        if (display_conf.timeout_enable) {
index f65f2a1..a72733c 100644 (file)
@@ -2838,7 +2838,9 @@ static void display_init(void *data)
                                power_ops.power_lock();
                        }
                        pm_cur_state = S_NORMAL;
-                       vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       ret = vconf_set_int(VCONFKEY_PM_STATE, pm_cur_state);
+                       if (ret < 0)
+                               _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
 
                        status = DEVICE_OPS_STATUS_START;
                        if (display_conf.timeout_enable) {
index 773825f..d95e557 100644 (file)
@@ -1157,8 +1157,12 @@ static void sim_signal_handler(GDBusConnection  *conn,
 
        if (val != SIM_CARD_NOT_PRESENT) {
                state = true;
-               vconf_set_bool(VCONFKEY_LCD_BRIGHTNESS_INIT, state);
-               vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, PM_DEFAULT_BRIGHTNESS);
+               ret = vconf_set_bool(VCONFKEY_LCD_BRIGHTNESS_INIT, state);
+               if (ret < 0)
+                               _E("Failed to set vconf value for lcd brightness: %d", vconf_get_ext_errno());
+               ret = vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, PM_DEFAULT_BRIGHTNESS);
+               if (ret < 0)
+                               _E("Failed to set vconf value for lcd brightness: %d", vconf_get_ext_errno());
                backlight_ops.set_brightness(PM_DEFAULT_BRIGHTNESS);
                _I("SIM card is inserted at first.");
        }
index 3f69d31..1346ac5 100644 (file)
@@ -75,6 +75,10 @@ static GVariant *dbus_ir_transmit(GDBusConnection *conn,
 
        size = g_variant_iter_n_children(iter);
        freq_pattern = (int*)malloc(sizeof(int) * size);
+       if (!freq_pattern) {
+               ret = -ENOMEM;
+               goto exit;
+       }
 
        while (g_variant_iter_next(iter, "i", &freq_pattern[i++]))
                ;
@@ -86,7 +90,8 @@ static GVariant *dbus_ir_transmit(GDBusConnection *conn,
        ret = ir_dev->transmit(freq_pattern, size);
 
 exit:
-       free(freq_pattern);
+       if (freq_pattern)
+               free(freq_pattern);
        return g_variant_new("(i)", ret);
 }