Removed redundant memory allocation from zone.

Removed zone::create and zone::destroy.
We can use zone as follows:
   zone z; // on stack
   zone* z = new zone; // on heap

Fixed a resource leak when zone::push_finalizer(msgpack::unique_ptr<T>) is called.
This commit is contained in:
Takatoshi Kondo
2014-08-07 15:23:34 +09:00
parent b5b459cfca
commit 17e696fc0d
5 changed files with 111 additions and 128 deletions

View File

@@ -195,7 +195,7 @@ bool msgpack_zone_init(msgpack_zone* zone, size_t chunk_size)
msgpack_zone* msgpack_zone_new(size_t chunk_size)
{
msgpack_zone* zone = (msgpack_zone*)malloc(
sizeof(msgpack_zone) + chunk_size);
sizeof(msgpack_zone));
if(zone == NULL) {
return NULL;
}