From cbe787d7031a6136680c3060aa28e606670146a9 Mon Sep 17 00:00:00 2001 From: pacbypass Date: Tue, 22 Apr 2025 01:54:08 -0700 Subject: [PATCH] fix memory leak in fuzz_matcher.cc (#3847) --- cpp/test/phonenumbers/fuzz_matcher.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/test/phonenumbers/fuzz_matcher.cc b/cpp/test/phonenumbers/fuzz_matcher.cc index aaacc57a1..de6f6a104 100644 --- a/cpp/test/phonenumbers/fuzz_matcher.cc +++ b/cpp/test/phonenumbers/fuzz_matcher.cc @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "phonenumbers/phonenumbermatcher.h" +#include #include #include #include @@ -78,8 +79,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // fuzz the matching with the icu adapter std::string matched_string; i18n::phonenumbers::ICURegExpFactory factory; - i18n::phonenumbers::RegExp* regexp = factory.CreateRegExp(regexp_string); + std::unique_ptr regexp( + factory.CreateRegExp(regexp_string)); regexp->Match(text, full_match, &matched_string); return 0; -} \ No newline at end of file +}