| 190 | } |
| 191 | |
| 192 | void destroyDom() { |
| 193 | if (!Allocator::kNeedFree) { |
| 194 | this->setType(kNull); |
| 195 | return; |
| 196 | } |
| 197 | // NOTE: must free dynamic nodes at first |
| 198 | reinterpret_cast<DNode<Allocator>*>(this)->~DNode(); |
| 199 | Allocator::Free(str_); |
| 200 | Allocator::Free(schema_str_); |
| 201 | // Avoid Double Free |
| 202 | str_ = nullptr; |
| 203 | schema_str_ = nullptr; |
| 204 | this->setType(kNull); |
| 205 | } |
| 206 | |
| 207 | template <unsigned parseFlags> |
| 208 | GenericDocument& parseImpl(const char* json, size_t len) { |