dbus: Fix a memory leak on error path in CreateInterface method

Fix a potential memory leak in CreateInterface method.

Fixes: 0ba266d86c ("dbus: Add virtual interface create/remove logic to be inline with ctrl_iface")
Signed-off-by: Jintao Lin <jintaolin@chromium.org>
This commit is contained in:
Jintao Lin 2022-12-06 00:37:04 +00:00 committed by Jouni Malinen
parent a7f6b85180
commit b0722cf75e

View file

@ -817,12 +817,14 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);
} else if (os_strcmp(entry.key, "Type") == 0 && } else if (os_strcmp(entry.key, "Type") == 0 &&
entry.type == DBUS_TYPE_STRING) { 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; 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; if_type = WPA_IF_AP_BSS;
else } else {
wpa_dbus_dict_entry_clear(&entry);
goto error; goto error;
}
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);
} else { } else {
wpa_dbus_dict_entry_clear(&entry); wpa_dbus_dict_entry_clear(&entry);