Status: Accepted
Owner: [email protected]
CC: [email protected]
Labels: Type-Defect Priority-Medium
New issue 257 by [email protected]: lsan false positive with new T[0]
http://code.google.com/p/address-sanitizer/issues/detail?id=257
If we call "new T[0]", where T is a class with DTOR,
we'll allocate a 8 byte chunk and store the pointer to the end of this
chunk.
% cat leak0.cc
#include <stdio.h>
struct T {
~T() { printf("~T\n"); }
};
T *t;
int main(int argc, char **argv) {
t = new T[argc - 1];
}
% clang++ -g leak0.cc -fsanitize=address &&
ASAN_OPTIONS=detect_leaks=1 ./a.out
=================================================================
==18656==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x4558b6 in operator new[](unsigned long)
/home/kcc/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:56
#1 0x46c655 in main /home/kcc/tmp/leak0.cc:9
#2 0x7f5a8fa6476c in __libc_start_main
/build/buildd/eglibc-2.15/csu/libc-start.c:226
SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s).
%
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.