mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
AK: Don't allow Vector::resize_and_keep_capacity() in the kernel
This function doesn't propagate allocation failures. Replace the only current user of this function by using `shrink()` with `keep_capacity = true` instead.
This commit is contained in:
1 parent
fbb63faa1d
commit
636fb09f80
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -49,7 +49,7 @@ public:
|
||||
if (is_empty())
|
||||
return false;
|
||||
|
||||
m_stack.resize_and_keep_capacity(m_stack.size() - 1);
|
||||
m_stack.shrink(m_stack.size() - 1, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -788,13 +788,13 @@ public:
|
||||
{
|
||||
MUST(try_resize(new_size, keep_capacity));
|
||||
}
|
||||
#endif
|
||||
|
||||
void resize_and_keep_capacity(size_t new_size)
|
||||
requires(!contains_reference)
|
||||
{
|
||||
MUST(try_resize_and_keep_capacity(new_size));
|
||||
}
|
||||
#endif
|
||||
|
||||
void shrink_to_fit()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user