Add allocator_frees_and_returns_null_on_realloc_zero=false flag for compatibility...
authorFilipe Cabecinhas <me@filcab.net>
Wed, 29 Mar 2017 18:17:22 +0000 (18:17 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Wed, 29 Mar 2017 18:17:22 +0000 (18:17 +0000)
commite144b723727f4264cc0a22656191156cf1b8edb1
tree9208c90b3b7cf79dda87f1232296178400f1349e
parent762f928a7a64133a1c5dab73d469440bb2e21b26
Add allocator_frees_and_returns_null_on_realloc_zero=false flag for compatibility with allocators which allow a realloc(p, 0) and don't free the pointer.

Summary:
I know of two implementations that do this (ASan is not protecting against accessing the returned memory for now, just like malloc(0)):
SIE libc on the PS4
dlmalloc has a flag for this

This allows us to properly support this behaviour.

Reviewers: vsk, kcc

Subscribers: llvm-commits, kubamracek

Differential Revision: https://reviews.llvm.org/D31295

llvm-svn: 299016
compiler-rt/lib/asan/asan_allocator.cc
compiler-rt/lib/asan/asan_flags.inc
compiler-rt/test/asan/TestCases/realloc.cc [new file with mode: 0644]