Revision: 21320
Author:   [email protected]
Date:     Thu May 15 07:16:46 2014 UTC
Log:      Avoid memset(NULL, ...).

[email protected]

Review URL: https://codereview.chromium.org/290453003
http://code.google.com/p/v8/source/detail?r=21320

Modified:
 /branches/bleeding_edge/samples/shell.cc
 /branches/bleeding_edge/src/d8.cc

=======================================
--- /branches/bleeding_edge/samples/shell.cc    Thu May  8 06:52:35 2014 UTC
+++ /branches/bleeding_edge/samples/shell.cc    Thu May 15 07:16:46 2014 UTC
@@ -68,7 +68,8 @@
 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); }
=======================================
--- /branches/bleeding_edge/src/d8.cc   Wed May 14 16:28:46 2014 UTC
+++ /branches/bleeding_edge/src/d8.cc   Thu May 15 07:16:46 2014 UTC
@@ -1450,7 +1450,8 @@
 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); }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to