Browse Source

fix memory leak in fuzz_matcher.cc (#3847)

pull/3849/head
pacbypass 8 months ago
committed by GitHub
parent
commit
cbe787d703
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      cpp/test/phonenumbers/fuzz_matcher.cc

+ 4
- 2
cpp/test/phonenumbers/fuzz_matcher.cc View File

@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
#include "phonenumbers/phonenumbermatcher.h"
#include <memory>
#include <string>
#include <vector>
#include <limits>
@ -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<i18n::phonenumbers::RegExp> regexp(
factory.CreateRegExp(regexp_string));
regexp->Match(text, full_match, &matched_string);
return 0;
}
}

Loading…
Cancel
Save