From 1aba1fe8b1fd8efaa9f500f191bb4f4180020c93 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 21 Aug 2018 14:08:53 +0200 Subject: [PATCH] heap: diagnostic message on alloc(0) --- repos/base/src/lib/base/heap.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/repos/base/src/lib/base/heap.cc b/repos/base/src/lib/base/heap.cc index 6dd3bd3d1f..1065c1d957 100644 --- a/repos/base/src/lib/base/heap.cc +++ b/repos/base/src/lib/base/heap.cc @@ -215,6 +215,9 @@ bool Heap::_unsynchronized_alloc(size_t size, void **out_addr) bool Heap::alloc(size_t size, void **out_addr) { + if (size == 0) + error("attempt to allocated zero-size block from heap"); + /* serialize access of heap functions */ Lock::Guard lock_guard(_lock);