Skip to content

Commit

Permalink
wifi: Do not access unitialized timestamp
Browse files Browse the repository at this point in the history
When the Modified is missing in the keyfile we would just
go on use the unitialized variable.

While we are at it, also drop the unnessary checks for NULL
string before passing it to g_free().

Reported by coverity.
  • Loading branch information
Daniel Wagner authored and pfl committed Nov 27, 2013
1 parent e6390f5 commit f066853
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions plugins/wifi.c
Expand Up @@ -960,8 +960,7 @@ static int get_latest_connections(int max_ssids,
str = g_key_file_get_string(keyfile,
services[i], "Favorite", NULL);
if (!str || g_strcmp0(str, "true")) {
if (str)
g_free(str);
g_free(str);
g_key_file_free(keyfile);
continue;
}
Expand All @@ -970,19 +969,20 @@ static int get_latest_connections(int max_ssids,
str = g_key_file_get_string(keyfile,
services[i], "AutoConnect", NULL);
if (!str || g_strcmp0(str, "true")) {
if (str)
g_free(str);
g_free(str);
g_key_file_free(keyfile);
continue;
}
g_free(str);

str = g_key_file_get_string(keyfile,
services[i], "Modified", NULL);
if (str) {
g_time_val_from_iso8601(str, &modified);
g_free(str);
if (!str) {
g_key_file_free(keyfile);
continue;
}
g_time_val_from_iso8601(str, &modified);
g_free(str);

ssid = g_key_file_get_string(keyfile,
services[i], "SSID", NULL);
Expand Down

0 comments on commit f066853

Please sign in to comment.