eap-ttls: Address mem leak reported by coverity
PATCH 1/2 eap-ttls: Address mem leak reported by coverity
The issue has appeared in 6017dc573
--- src/eap-ttls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/eap-ttls.c +3 -1
@@ -1089,7 +1089,7 @@ static bool eap_ttls_settings_load(struct eap_state *eap,struct l_settings *settings, const char *prefix) { - struct phase2_method *phase2 = l_new(struct phase2_method, 1); + struct phase2_method *phase2;const char *phase2_method_name;char setting[72 ];uint8_t i;
@@ -1100,6 +1100,8 @@ static bool eap_ttls_settings_load(struct eap_state *eap,if (!phase2_method_name)return false; + phase2 = l_new(struct phase2_method, 1); +snprintf (setting,sizeof (setting),"%sTTLS-Phase2-" , prefix);for (i =0 ; tunneled_non_eap_method_ops[i].name; i++) {
Signature · 1 line
2.13.6
PATCH 2/2 client: Address dbl free reported by coverity
In practice, the double free isn't possible in this logic.
It also simplifies the print logic
--- client/station.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-)
client/station.c +9 -17
@@ -338,7 +338,6 @@ static void ordered_networks_display(struct l_queue *ordered_networks) {char *dbms =NULL ;const struct l_queue_entry *entry; -bool is_first; display_table_header("Available networks", "%s%-*s%-*s%-*s%*s", MARGIN, 2, "", 32, "Network name",
@@ -351,7 +350,7 @@ static void ordered_networks_display(struct l_queue *ordered_networks)return ; } -for (is_first = true, entry =l_queue_get_entries (ordered_networks); +for (entry =l_queue_get_entries (ordered_networks); entry; entry = entry->next) {struct ordered_network *network = entry->data; const struct proxy_interface *network_i =
@@ -362,24 +361,17 @@ static void ordered_networks_display(struct l_queue *ordered_networks)if (display_signal_as_dbms) dbms =l_strdup_printf ("%d" , network->signal_strength); -if (is_first &&network_is_connected (network_i)) { -display ("%s%-*s%-*s%-*s%-*s\n" ,MARGIN , -2 ,COLOR_BOLDGRAY "> " COLOR_OFF , -32 , network_name,10 , network_type, -6 , display_signal_as_dbms ? dbms : -dbms_tostars (network->signal_strength)); +display ("%s%-*s%-*s%-*s%-*s\n" ,MARGIN ,2 , +network_is_connected (network_i) ? +COLOR_BOLDGRAY "> " COLOR_OFF :"" , +32 , network_name,10 , network_type, +6 , display_signal_as_dbms ? dbms : +dbms_tostars (network->signal_strength)); +if (display_signal_as_dbms) {l_free (dbms); - is_first = false; -continue ; + dbms =NULL ; } - -display ("%s%-*s%-*s%-*s%-*s\n" ,MARGIN ,2 ,"" , -32 , network_name,10 , network_type, -6 , display_signal_as_dbms ? dbms : -dbms_tostars (network->signal_strength)); - -l_free (dbms); }display_table_footer ();
Signature · 1 line
2.13.6
Hi Tim,
Quoted 5 lines · Tim Kourt
The issue has appeared in
6017dc573--- src/eap-ttls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Both applied, thanks.
Regards,
-Denis