diff --git a/Userland/Libraries/LibCore/GetPassword.cpp b/Userland/Libraries/LibCore/GetPassword.cpp index a0d2987b21..56d1433f1f 100644 --- a/Userland/Libraries/LibCore/GetPassword.cpp +++ b/Userland/Libraries/LibCore/GetPassword.cpp @@ -40,6 +40,6 @@ ErrorOr get_password(StringView prompt) // Remove trailing '\n' read by getline(). password[line_length - 1] = '\0'; - return SecretString::take_ownership(password, line_length); + return TRY(SecretString::take_ownership(password, line_length)); } } diff --git a/Userland/Libraries/LibCore/SecretString.cpp b/Userland/Libraries/LibCore/SecretString.cpp index 493427d423..58c1a02831 100644 --- a/Userland/Libraries/LibCore/SecretString.cpp +++ b/Userland/Libraries/LibCore/SecretString.cpp @@ -10,9 +10,9 @@ namespace Core { -SecretString SecretString::take_ownership(char*& cstring, size_t length) +ErrorOr SecretString::take_ownership(char*& cstring, size_t length) { - auto buffer = ByteBuffer::copy(cstring, length).release_value_but_fixme_should_propagate_errors(); + auto buffer = TRY(ByteBuffer::copy(cstring, length)); secure_zero(cstring, length); free(cstring); diff --git a/Userland/Libraries/LibCore/SecretString.h b/Userland/Libraries/LibCore/SecretString.h index f6440eb285..0e5db04d6e 100644 --- a/Userland/Libraries/LibCore/SecretString.h +++ b/Userland/Libraries/LibCore/SecretString.h @@ -16,7 +16,7 @@ class SecretString { AK_MAKE_NONCOPYABLE(SecretString); public: - [[nodiscard]] static SecretString take_ownership(char*&, size_t); + [[nodiscard]] static ErrorOr take_ownership(char*&, size_t); [[nodiscard]] static SecretString take_ownership(ByteBuffer&&); [[nodiscard]] bool is_empty() const { return m_secure_buffer.is_empty(); }