[PATCH] D31295: Add free_on_realloc_zero=true flag for compatibility with allocators which allow a realloc(p, 0) and don't free the pointer.
Kostya Serebryany via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 16:30:31 PDT 2017
kcc added a comment.
Ok, let's do it. But I'd like to choose a better flag name.
================
Comment at: lib/asan/asan_allocator.cc:803
if (size == 0) {
- instance.Deallocate(p, 0, stack, FROM_MALLOC);
- return nullptr;
+ if (flags()->free_on_realloc_zero) {
+ instance.Deallocate(p, 0, stack, FROM_MALLOC);
----------------
maybe "free_and return_null_on_realloc_zero"?
Os some other name with the opposite meaning (and default=false):
allocator_returns_non_null_on_realloc_zero?
https://reviews.llvm.org/D31295
More information about the llvm-commits
mailing list