]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Fix some memory leaks on error paths
authorJouni Malinen <jouni@codeaurora.org>
Wed, 8 May 2019 19:06:46 +0000 (22:06 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 8 May 2019 19:06:46 +0000 (22:06 +0300)
wpa_dbus_dict_close_write() was not called if
fill_dict_with_properties() fails and that could result in leaking
memory. Fix this in two cases. There might be other missing calls to
jouni@codeaurora.org() on error paths, but those will need to be handled
separately with more complex changes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/dbus/dbus_new_helpers.c

index 0115e32a1d34b29ed2cf927aeab7392e55a20ea8..d80e2d402071933e8f50e7803b5ea857eac4787d 100644 (file)
@@ -98,6 +98,7 @@ static DBusMessage * get_all_properties(DBusMessage *message, char *interface,
        dbus_error_init(&error);
        if (!fill_dict_with_properties(&dict_iter, obj_dsc->properties,
                                       interface, obj_dsc->user_data, &error)) {
+               wpa_dbus_dict_close_write(&iter, &dict_iter);
                dbus_message_unref(reply);
                reply = wpas_dbus_reply_new_from_error(
                        message, &error, DBUS_ERROR_INVALID_ARGS,
@@ -930,6 +931,7 @@ dbus_bool_t wpa_dbus_get_object_properties(struct wpas_dbus_priv *iface,
                           dbus_error_is_set(&error) ? error.name : "none",
                           dbus_error_is_set(&error) ? error.message : "none");
                dbus_error_free(&error);
+               wpa_dbus_dict_close_write(iter, &dict_iter);
                return FALSE;
        }