Skip to content

Commit

Permalink
Bug 1742000 - Don't call hunspell rlbox::destroy_sandbox when create_…
Browse files Browse the repository at this point in the history
…sandbox failed r=bholley

Differential Revision: https://phabricator.services.mozilla.com/D162359
  • Loading branch information
shravanrn committed Nov 18, 2022
1 parent 34298cf commit 5591e0b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extensions/spellcheck/hunspell/glue/RLBoxHunspell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RLBoxHunspell* RLBoxHunspell::Create(const nsCString& affpath,
const nsCString& dpath) {
MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread());

mozilla::UniquePtr<rlbox_sandbox_hunspell, RLBoxDeleter> sandbox(
mozilla::UniquePtr<rlbox_sandbox_hunspell> sandbox(
new rlbox_sandbox_hunspell());

#if defined(MOZ_WASM_SANDBOXING_HUNSPELL) && !defined(HAVE_64BIT_BUILD)
Expand Down Expand Up @@ -75,6 +75,9 @@ RLBoxHunspell* RLBoxHunspell::Create(const nsCString& affpath,

NS_ENSURE_TRUE(success, nullptr);

mozilla::UniquePtr<rlbox_sandbox_hunspell, RLBoxDeleter> sandbox_initialized(
sandbox.release());

// Add the aff and dict files to allow list
if (!affpath.IsEmpty()) {
mozHunspellCallbacks::AllowFile(affpath);
Expand All @@ -84,7 +87,7 @@ RLBoxHunspell* RLBoxHunspell::Create(const nsCString& affpath,
}

// TODO Bug 1788857: Verify error handling in case of inaccessible file
return new RLBoxHunspell(std::move(sandbox), affpath, dpath);
return new RLBoxHunspell(std::move(sandbox_initialized), affpath, dpath);
}

RLBoxHunspell::RLBoxHunspell(
Expand Down

0 comments on commit 5591e0b

Please sign in to comment.