Initialized regex with schema allocator.

This commit is contained in:
Étienne Dupuis 2017-10-05 11:39:21 +02:00
parent 2a0bc6062b
commit 6e08e29425

View File

@ -935,7 +935,7 @@ private:
}; };
#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX #if RAPIDJSON_SCHEMA_USE_INTERNALREGEX
typedef internal::GenericRegex<EncodingType> RegexType; typedef internal::GenericRegex<EncodingType, AllocatorType> RegexType;
#elif RAPIDJSON_SCHEMA_USE_STDREGEX #elif RAPIDJSON_SCHEMA_USE_STDREGEX
typedef std::basic_regex<Ch> RegexType; typedef std::basic_regex<Ch> RegexType;
#else #else
@ -995,7 +995,7 @@ private:
template <typename ValueType> template <typename ValueType>
RegexType* CreatePattern(const ValueType& value) { RegexType* CreatePattern(const ValueType& value) {
if (value.IsString()) { if (value.IsString()) {
RegexType* r = new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString()); RegexType* r = new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString(), allocator_);
if (!r->IsValid()) { if (!r->IsValid()) {
r->~RegexType(); r->~RegexType();
AllocatorType::Free(r); AllocatorType::Free(r);