From: hyunuk.tak Date: Thu, 17 Sep 2020 04:44:05 +0000 (+0900) Subject: Fix some coverity X-Git-Tag: submit/tizen/20200918.062939~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9db93af816de1f9f894aabadd7ef06a9088ed9ce;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Fix some coverity FORWARD_NULL, REVERSE_INULL, RESOURCE_LEAK Change-Id: I000aabec4e012889734c6f5f17f077023dcb0092 Signed-off-by: hyunuk.tak --- diff --git a/src/signal-handler.c b/src/signal-handler.c index bd7004b..495881b 100755 --- a/src/signal-handler.c +++ b/src/signal-handler.c @@ -375,15 +375,18 @@ static void _technology_signal_cb(GDBusConnection *conn, } else if (g_strcmp0(key, "Powered") == 0) { bvalue = g_variant_get_boolean(var); DBG("Powered [%d]", bvalue); - wifi_state_update_power_state(svalue, bvalue); + if (svalue) + wifi_state_update_power_state(svalue, bvalue); } else if (g_strcmp0(key, "Connected") == 0) { bvalue = g_variant_get_boolean(var); DBG("Connected [%d]", bvalue); - wifi_state_set_connected(svalue, bvalue); - if (bvalue == TRUE) - wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_CONNECTED); - else - wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_POWERED); + if (svalue) { + wifi_state_set_connected(svalue, bvalue); + if (bvalue == TRUE) + wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_CONNECTED); + else + wifi_state_set_technology_state(svalue, NETCONFIG_WIFI_TECH_POWERED); + } } } g_variant_iter_free(iter); diff --git a/src/utils/setting.c b/src/utils/setting.c index a278a01..8412379 100755 --- a/src/utils/setting.c +++ b/src/utils/setting.c @@ -92,6 +92,7 @@ static void __setting_set_string_list(GKeyFile *keyfile, netconfig_setting_type_ netconfig_setting_data[type].key, NULL); } + g_strfreev(string_list); g_string_free(string_str, TRUE); } } diff --git a/src/utils/util.c b/src/utils/util.c index e139ab8..495e2ac 100755 --- a/src/utils/util.c +++ b/src/utils/util.c @@ -158,12 +158,16 @@ void netconfig_keyfile_save(GKeyFile *keyfile, const char *pathname) gchar *needle = NULL, *directory = NULL; directory = g_strdup(pathname); - needle = g_strrstr(directory, "/"); + if (directory == NULL) { + ERR("directory is NULL"); + return; + } + needle = g_strrstr(directory, "/"); if (needle != NULL) *needle = '\0'; - if (directory == NULL || (*directory) == '\0') { + if ((*directory) == '\0') { g_free(directory); ERR("directory is NULL"); return;