From b74b3c80fc985bde7c5e54d84d496a59154f7de6 Mon Sep 17 00:00:00 2001 From: Alexandra Latysheva Date: Wed, 28 Oct 2020 13:16:15 +0000 Subject: [PATCH] use local variable instead of dynamic variable in TiffSapiSandbox::ModifyPolicy --- oss-internship-2020/libtiff/sandboxed.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/oss-internship-2020/libtiff/sandboxed.h b/oss-internship-2020/libtiff/sandboxed.h index 4af50d4..95bacaa 100644 --- a/oss-internship-2020/libtiff/sandboxed.h +++ b/oss-internship-2020/libtiff/sandboxed.h @@ -31,8 +31,7 @@ class TiffSapiSandbox : public TiffSandbox { private: std::unique_ptr ModifyPolicy( sandbox2::PolicyBuilder*) override { - auto builder = std::make_unique(); - (*builder) + sandbox2::PolicyBuilder builder = sandbox2::PolicyBuilder() .AllowRead() .AllowStaticStartup() .AllowWrite() @@ -51,14 +50,14 @@ class TiffSapiSandbox : public TiffSandbox { }); if (file_) { - builder->AddFile(file_.value(), /*is_ro=*/false); + builder.AddFile(file_.value(), /*is_ro=*/false); } if (dir_) { - builder->AddDirectory(dir_.value(), /*is_ro=*/false); + builder.AddDirectory(dir_.value(), /*is_ro=*/false); } - return builder.get()->BuildOrDie(); + return builder.BuildOrDie(); } std::optional file_;