diff options
author | ivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2013-04-24 21:02:55 +0000 |
---|---|---|
committer | ivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2013-04-24 21:02:55 +0000 |
commit | ae3947e1234a53eab752f7f81272cf3e00dc1a34 (patch) | |
tree | fe5e633dd7a8bbf2c8af3099ff548e8310beca70 /src | |
parent | Rewrite SimpleStringDictionary with NonAllocatingMap. (diff) | |
download | breakpad-ae3947e1234a53eab752f7f81272cf3e00dc1a34.tar.xz |
Fix Clang warning regarding null pointer argument.
This warning was showing up in the Clang static analyzer in Xcode: "Null pointer argument in call to memory copy function"
Fix provided by Ian Wilkinson.
Review URL: https://breakpad.appspot.com/569002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1162 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r-- | src/common/memory.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/memory.h b/src/common/memory.h index e90bd52c..b191449b 100644 --- a/src/common/memory.h +++ b/src/common/memory.h @@ -197,7 +197,9 @@ class wasteful_vector { void Realloc(unsigned new_size) { T *new_array = reinterpret_cast<T*>(allocator_->Alloc(sizeof(T) * new_size)); - memcpy(new_array, a_, used_ * sizeof(T)); + if (new_size > 0) { + memcpy(new_array, a_, used_ * sizeof(T)); + } a_ = new_array; allocated_ = new_size; } |