We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9246886 commit 58ec873Copy full SHA for 58ec873
inst/include/s2/util/gtl/compact_array.h
@@ -393,8 +393,10 @@ class compact_array_base {
393
value_allocator_type allocator;
394
395
T* new_ptr = allocator.allocate(capacity());
396
- memcpy(new_ptr, Array(), old_capacity * sizeof(T));
397
- allocator.deallocate(Array(), old_capacity);
+ if (old_capacity > 0) {
+ memcpy(new_ptr, Array(), old_capacity * sizeof(T));
398
+ allocator.deallocate(Array(), old_capacity);
399
+ }
400
401
SetArray(new_ptr);
402
}
0 commit comments