Skip to content

Commit cbe787d

Browse files
authored
fix memory leak in fuzz_matcher.cc (#3847)
1 parent 8e0b576 commit cbe787d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/test/phonenumbers/fuzz_matcher.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
*/
1515
#include "phonenumbers/phonenumbermatcher.h"
16+
#include <memory>
1617
#include <string>
1718
#include <vector>
1819
#include <limits>
@@ -78,8 +79,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
7879
// fuzz the matching with the icu adapter
7980
std::string matched_string;
8081
i18n::phonenumbers::ICURegExpFactory factory;
81-
i18n::phonenumbers::RegExp* regexp = factory.CreateRegExp(regexp_string);
82+
std::unique_ptr<i18n::phonenumbers::RegExp> regexp(
83+
factory.CreateRegExp(regexp_string));
8284
regexp->Match(text, full_match, &matched_string);
8385

8486
return 0;
85-
}
87+
}

0 commit comments

Comments
 (0)