Index: samples/shell.cc |
diff --git a/samples/shell.cc b/samples/shell.cc |
index e9f99896e9c3ada9afdbfa263cd0c419e54ee88f..aebe49d49e7763038bb840e93bc3d5a290a43de8 100644 |
--- a/samples/shell.cc |
+++ b/samples/shell.cc |
@@ -68,7 +68,8 @@ static bool run_shell; |
class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
public: |
virtual void* Allocate(size_t length) { |
- return memset(AllocateUninitialized(length), 0, length); |
+ void* data = AllocateUninitialized(length); |
+ return data == NULL ? data : memset(data, 0, length); |
} |
virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
virtual void Free(void* data, size_t) { free(data); } |