Skip to content

Commit

Permalink
Fixed a bug for SchemaDocument move constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
miloyip committed Oct 18, 2016
1 parent 7c4e511 commit bf0cc7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/rapidjson/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,7 @@ class GenericSchemaDocument {
allocator_(allocator),
ownAllocator_(),
root_(),
typeless_(),
schemaMap_(allocator, kInitialSchemaMapSize),
schemaRef_(allocator, kInitialSchemaRefSize)
{
Expand Down Expand Up @@ -1398,8 +1399,10 @@ class GenericSchemaDocument {
while (!schemaMap_.Empty())
schemaMap_.template Pop<SchemaEntry>(1)->~SchemaEntry();

typeless_->~SchemaType();
Allocator::Free(typeless_);
if (typeless_) {
typeless_->~SchemaType();
Allocator::Free(typeless_);
}

RAPIDJSON_DELETE(ownAllocator_);
}
Expand Down

0 comments on commit bf0cc7b

Please sign in to comment.