From 07259554b3cfab91a455dcc23cc637b299605a9e Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 20 Oct 2011 09:51:23 +0200 Subject: Do not allocate memory for buffer if constructed with zero capacity --- odb/details/buffer.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odb/details/buffer.hxx b/odb/details/buffer.hxx index 8f0dc83..3dc1c03 100644 --- a/odb/details/buffer.hxx +++ b/odb/details/buffer.hxx @@ -22,14 +22,14 @@ namespace odb public: ~basic_buffer_base () { - if (data_) + if (data_ != 0) operator delete (data_); } basic_buffer_base (std::size_t capacity) : capacity_ (capacity) { - data_ = operator new (capacity_); + data_ = capacity_ == 0 ? 0 : operator new (capacity_); } std::size_t -- cgit v1.1