diff options
author | MITSUNARI Shigeo <[email protected]> | 2013-04-17 11:11:12 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2013-04-17 11:11:12 +0900 |
commit | 82024c13a8469d7b5f7d546e890c4c625d99273e (patch) | |
tree | 51d33f688069972150db76c2c41873cc1ee0614f | |
parent | 4a04d4f74ee3d356266eba412712d2601f6450f5 (diff) | |
download | xbyak-82024c13a8469d7b5f7d546e890c4c625d99273e.tar.gz xbyak-82024c13a8469d7b5f7d546e890c4c625d99273e.zip |
avoid alloc(0)
-rw-r--r-- | xbyak/xbyak.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 7119834..c179d12 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -527,7 +527,7 @@ public: : type_(getType(maxSize, userPtr)) , alloc_(allocator ? allocator : &defaultAllocator_) , maxSize_(maxSize) - , top_(isAllocType() ? alloc_->alloc(maxSize) : type_ == USER_BUF ? reinterpret_cast<uint8*>(userPtr) : buf_) + , top_(isAllocType() ? alloc_->alloc((std::max<size_t>)(maxSize, 1)) : type_ == USER_BUF ? reinterpret_cast<uint8*>(userPtr) : buf_) , size_(0) { if (maxSize_ > 0 && top_ == 0) throw ERR_CANT_ALLOC; |