From: Jintao Lin Date: Tue, 6 Dec 2022 00:37:04 +0000 (+0000) Subject: dbus: Fix a memory leak on error path in CreateInterface method X-Git-Tag: hostap_2_11~1383 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0722cf75ec701c746ce38ccf1a34d833fe13aed;p=thirdparty%2Fhostap.git dbus: Fix a memory leak on error path in CreateInterface method Fix a potential memory leak in CreateInterface method. Fixes: 0ba266d86c90 ("dbus: Add virtual interface create/remove logic to be inline with ctrl_iface") Signed-off-by: Jintao Lin --- diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 9a0f8c157..d2c78ecfa 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -817,12 +817,14 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message, wpa_dbus_dict_entry_clear(&entry); } else if (os_strcmp(entry.key, "Type") == 0 && entry.type == DBUS_TYPE_STRING) { - if (os_strcmp(entry.str_value, "sta") == 0) + if (os_strcmp(entry.str_value, "sta") == 0) { if_type = WPA_IF_STATION; - else if (os_strcmp(entry.str_value, "ap") == 0) + } else if (os_strcmp(entry.str_value, "ap") == 0) { if_type = WPA_IF_AP_BSS; - else + } else { + wpa_dbus_dict_entry_clear(&entry); goto error; + } wpa_dbus_dict_entry_clear(&entry); } else { wpa_dbus_dict_entry_clear(&entry);