Commit e7149d66 authored by Milo Yip's avatar Milo Yip

Fix memory leak for invalid regex

parent 26e69ffd
...@@ -1006,6 +1006,7 @@ private: ...@@ -1006,6 +1006,7 @@ private:
RegexType* r = new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString()); RegexType* r = new (allocator_->Malloc(sizeof(RegexType))) RegexType(value.GetString());
if (!r->IsValid()) { if (!r->IsValid()) {
r->~RegexType(); r->~RegexType();
AllocatorType::Free(r);
r = 0; r = 0;
} }
return r; return r;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment