1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

Kernel: Handle OOM failures in find_shebang_interpreter_for_executable

This commit is contained in:
Idan Horowitz 2022-01-25 15:45:48 +02:00
parent 8cf0e4a5e4
commit d1433c35b0

View file

@ -691,7 +691,7 @@ static ErrorOr<NonnullOwnPtrVector<KString>> find_shebang_interpreter_for_execut
if (first_page[i] == ' ') { if (first_page[i] == ' ') {
if (word_length > 0) { if (word_length > 0) {
auto word = TRY(KString::try_create(StringView { &first_page[word_start], word_length })); auto word = TRY(KString::try_create(StringView { &first_page[word_start], word_length }));
interpreter_words.append(move(word)); TRY(interpreter_words.try_append(move(word)));
} }
word_length = 0; word_length = 0;
word_start = i + 1; word_start = i + 1;
@ -700,7 +700,7 @@ static ErrorOr<NonnullOwnPtrVector<KString>> find_shebang_interpreter_for_execut
if (word_length > 0) { if (word_length > 0) {
auto word = TRY(KString::try_create(StringView { &first_page[word_start], word_length })); auto word = TRY(KString::try_create(StringView { &first_page[word_start], word_length }));
interpreter_words.append(move(word)); TRY(interpreter_words.try_append(move(word)));
} }
if (!interpreter_words.is_empty()) if (!interpreter_words.is_empty())