summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/environment.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/api/environment.cc b/src/api/environment.cc
index a87f591e4e..70228b77d8 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -139,7 +139,11 @@ void DebuggingArrayBufferAllocator::UnregisterPointerInternal(void* data,
if (data == nullptr) return;
auto it = allocations_.find(data);
CHECK_NE(it, allocations_.end());
- CHECK_EQ(it->second, size);
+ if (size > 0) {
+ // We allow allocations with size 1 for 0-length buffers to avoid having
+ // to deal with nullptr values.
+ CHECK_EQ(it->second, size);
+ }
allocations_.erase(it);
}