We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a632160 commit 3e69567Copy full SHA for 3e69567
include/rapidjson/schema.h
@@ -1150,10 +1150,12 @@ class Schema {
1150
template <typename ValueType>
1151
RegexType* CreatePattern(const ValueType& value) {
1152
if (value.IsString())
1153
+ RegexType *r = static_cast<RegexType*>(allocator_->Malloc(sizeof(RegexType)));
1154
try {
- return new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString(), std::size_t(value.GetStringLength()), std::regex_constants::ECMAScript);
1155
+ return new (r) RegexType(value.GetString(), std::size_t(value.GetStringLength()), std::regex_constants::ECMAScript);
1156
}
1157
catch (const std::regex_error&) {
1158
+ AllocatorType::Free(r);
1159
1160
return 0;
1161
0 commit comments