gchar *tmp = NULL;
gchar mac[13] = { 0, };
gint i = 0, j = 0;
-#if defined TIZEN_TV
- FILE *fp = NULL;
- char buf[WIFI_MAC_ADD_LENGTH + 1];
- if (0 == access(WIFI_MAC_ADD_PATH, F_OK))
- fp = fopen(WIFI_MAC_ADD_PATH, "r");
-
- if (fp == NULL) {
- ERR("Failed to open file %s\n", WIFI_MAC_ADD_PATH);
- *mac_address = NULL;
- return FALSE;
- }
- if (fgets(buf, sizeof(buf), fp) == NULL) {
- ERR("Failed to get MAC info from %s\n", WIFI_MAC_ADD_PATH);
- *mac_address = NULL;
- fclose(fp);
- return FALSE;
- }
- tmp_mac = (char *)g_try_malloc0(WIFI_MAC_ADD_LENGTH + 1);
- if (tmp_mac == NULL) {
- ERR("malloc() failed");
- *mac_address = NULL;
+ if (TIZEN_TV) {
+ FILE *fp = NULL;
+ char buf[WIFI_MAC_ADD_LENGTH + 1];
+ if (0 == access(WIFI_MAC_ADD_PATH, F_OK))
+ fp = fopen(WIFI_MAC_ADD_PATH, "r");
+
+ if (fp == NULL) {
+ ERR("Failed to open file %s\n", WIFI_MAC_ADD_PATH);
+ *mac_address = NULL;
+ return FALSE;
+ }
+
+ if (fgets(buf, sizeof(buf), fp) == NULL) {
+ ERR("Failed to get MAC info from %s\n", WIFI_MAC_ADD_PATH);
+ *mac_address = NULL;
+ fclose(fp);
+ return FALSE;
+ }
+ tmp_mac = (gchar *)malloc(WIFI_MAC_ADD_LENGTH + 1);
+ if (tmp_mac == NULL) {
+ ERR("malloc() failed");
+ *mac_address = NULL;
+ fclose(fp);
+ return FALSE;
+ }
+ memset(tmp_mac, 0, WIFI_MAC_ADD_LENGTH + 1);
+ g_strlcpy(tmp_mac, buf, WIFI_MAC_ADD_LENGTH + 1);
fclose(fp);
- return FALSE;
- }
- g_strlcpy(tmp_mac, buf, WIFI_MAC_ADD_LENGTH + 1);
- fclose(fp);
-#else
- tmp_mac = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
- if (tmp_mac == NULL) {
- ERR("vconf_get_str(WIFI_BSSID_ADDRESS) Failed");
- *mac_address = NULL;
- return FALSE;
+ } else {
+ tmp_mac = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+ if (tmp_mac == NULL) {
+ ERR("vconf_get_str(WIFI_BSSID_ADDRESS) Failed");
+ *mac_address = NULL;
+ return FALSE;
+ }
}
-#endif
tmp = g_ascii_strdown(tmp_mac, (gssize)strlen(tmp_mac));
- g_free(tmp_mac);
+ free(tmp_mac);
while (tmp && tmp[i]) {
if (tmp[i] != ':')
mac[j++] = tmp[i];
keyfile = netconfig_keyfile_load(path);
if (keyfile == NULL) {
ERR("keyfile[%s] is NULL", path);
- g_free(path);
}
+ g_free(path);
+
return keyfile;
}
keyfile = __get_configuration_keyfile(group_name);
if (keyfile == NULL) {
ERR("Fail to __get_configuration_keyfile");
+ g_free(group_name);
return FALSE;
}
keyfile = __get_configuration_keyfile(group_name);
if (keyfile == NULL) {
ERR("Fail to __get_configuration_keyfile");
+ g_free(group_name);
return FALSE;
}
static GSList *_get_list(void)
{
GSList *list = NULL;
- struct dirent ent_struct;
struct dirent *dp = NULL;
DIR *dir;
return NULL;
}
- while ((readdir_r(dir, &ent_struct, &dp) == 0) && dp) {
+ while ((dp = readdir(dir)) != NULL) {
if (g_strcmp0(dp->d_name, ".") == 0 || g_strcmp0(dp->d_name, "..") == 0 ||
strncmp(dp->d_name, WIFI_CONFIG_PREFIX, strlen(WIFI_CONFIG_PREFIX)) != 0) {
continue;
wifi_complete_get_config_ids(wifi, context, (const gchar * const *)result);
for (i = 0; i < length; i++)
- if(result[i])
+ if (result[i])
g_free(result[i]);
if (result)
ret = __get_group_name(WIFI_CONFIG_PREFIX, config_id, &group_name);
if (ret != TRUE) {
+ g_free(conf->name);
+ g_free(conf->ssid);
+ g_free(conf->passphrase);
+ g_free(conf->is_hidden);
+ g_free(conf->proxy_address);
+ g_free(conf);
ERR("Fail to get_wifi_config_group_name");
return FALSE;
}
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_NAME, g_variant_new_string(conf->name));
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_SECURITY_TYPE, g_variant_new_string(conf->security_type));
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_HIDDEN, g_variant_new_string(conf->is_hidden));
- if (conf->proxy_address != NULL) {
+ if (conf->proxy_address != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(conf->proxy_address));
- } else
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string("NONE"));
- if (conf->last_error != NULL) {
+ if (conf->last_error != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string(conf->last_error));
- } else
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string("ERROR_NONE"));
if (conf->eap_config != NULL) {