diff --git a/RTCP/Cobalt/CoInterface/src/Allocator.cc b/RTCP/Cobalt/CoInterface/src/Allocator.cc index d7ff56675a650229e53d061d4635084d4b688e68..2b15c4eccc503f9aabd6da17df32c9950410656f 100644 --- a/RTCP/Cobalt/CoInterface/src/Allocator.cc +++ b/RTCP/Cobalt/CoInterface/src/Allocator.cc @@ -121,7 +121,8 @@ namespace LOFAR ScopedLock sl(mutex); // if we allocate 0 bytes, we could end up returning the same pointer for a subsequent allocation. - if (size == 0) size = 1; + // since allocations with 0 bytes shouldn't be dereferenced anyway, we return NULL. + if (size == 0) return 0; // look for a free range large enough for (SparseSet<void *>::const_iterator it = freeList.getRanges().begin(); it != freeList.getRanges().end(); it++) {