mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-11-02 05:46:26 +01:00
Fix memory leak for invalid regex
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user