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
This commit is contained in:
parent
77acc6adab
commit
ae3947e123
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue