mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +00:00
Kernel: Make it possible for KBufferBuilder creation to fail
This patch adds KBufferBuilder::try_create() and treats it like anything else that can fail. And so, failure to allocate the initial internal buffer of the builder will now propagate an ENOMEM to the caller. :^)
This commit is contained in:
parent
be613b9ef6
commit
300402cc14
9 changed files with 30 additions and 13 deletions
|
@ -575,7 +575,12 @@ bool Process::dump_perfcore()
|
|||
}
|
||||
|
||||
auto& description = *description_or_error.value();
|
||||
KBufferBuilder builder;
|
||||
auto builder_or_error = KBufferBuilder::try_create();
|
||||
if (builder_or_error.is_error()) {
|
||||
dbgln("Failed to generate perfcore for pid {}: Could not allocate KBufferBuilder.", pid());
|
||||
return false;
|
||||
}
|
||||
auto builder = builder_or_error.release_value();
|
||||
if (!m_perf_event_buffer->to_json(builder)) {
|
||||
dbgln("Failed to generate perfcore for pid {}: Could not serialize performance events to JSON.", pid().value());
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue