slab: free slab page if page desc alloc failed

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
This commit is contained in:
Raphael S. Carvalho
2015-03-19 17:37:04 -03:00
committed by Avi Kivity
parent 6692435757
commit 087a34a544

View File

@@ -222,7 +222,7 @@ public:
auto objects = max_object_size / _size;
desc = new slab_page_desc(slab_page, objects, _size, _slab_class_id, slab_page_index);
} catch (const std::bad_alloc& e) {
// FIXME: Is there really a need to re-throw std::bad_alloc?
::free(slab_page);
throw std::bad_alloc{};
}