You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
%
Reported by konstantin.s.serebryany on 2014-01-10 09:14:09
The text was updated successfully, but these errors were encountered:
Originally reported on Google Code with ID 257
Reported by
konstantin.s.serebryany
on 2014-01-10 09:14:09The text was updated successfully, but these errors were encountered: