]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Fix a memory leak on error path in CreateInterface method
authorJintao Lin <jintaolin@chromium.org>
Tue, 6 Dec 2022 00:37:04 +0000 (00:37 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 17 Dec 2022 10:11:15 +0000 (12:11 +0200)
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 <jintaolin@chromium.org>
wpa_supplicant/dbus/dbus_new_handlers.c

index 9a0f8c157fbaa49890469cf9c3c689c6367809ef..d2c78ecfa70a3b951e1e632ad0f0444d6beecad9 100644 (file)
@@ -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);