aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-20 09:51:23 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:47:10 +0200
commit07259554b3cfab91a455dcc23cc637b299605a9e (patch)
treec0d1a7b398f8cca95d76090d0d21ac6e224e8945
parent6ec222043142135dabb57e8012613c64570e64d4 (diff)
Do not allocate memory for buffer if constructed with zero capacity
-rw-r--r--odb/details/buffer.hxx4
1 files 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