Questions tagged [leak-sanitizer]

LeakSanitizer (LSan) is a memory leak detector for GCC and Clang.

LeakSanitizer (LSan) is a run-time memory leak detector, available since Clang 3.4 and GCC 4.9. It is automatically enabled with AddressSanitizer (ASAN), but can also operate independently.

Once enabled at compile time using the -fsanitize=address or -fsanitize=leak, it will automatically be enabled at runtime. To disable that, use LSAN_OPTIONS=detect_leaks=0.

See also:

26 questions
1
vote
1 answer

GStreamer minimal program leaks memory

I have a minimal GStreamer program: #include int main() { gst_init(NULL, NULL); gst_deinit(); } I build it with gcc test.c $(pkg-config --cflags --libs gstreamer-1.0) -fsanitize=address (gcc is version 12.1.0), run it and get the…
Rudolf Lovrenčić
  • 147
  • 1
  • 2
  • 9
1
vote
0 answers

LeakSanitizer in macos: for objective-c function in stacktrace

clang is: └──( /opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang++ --version Homebrew clang version 13.0.1 Target: arm64-apple-darwin21.1.0 Thread model: posix InstalledDir: /opt/homebrew/Cellar/llvm/13.0.1_1/bin ASAN_OPTIONS is…
fatfatson
  • 796
  • 10
  • 24
1
vote
1 answer

Suppress LeakSanitizer output

How can I suppress LeakSanitizer outputs? For Address Sanitizer, I can use __attribute__((no_sanitize_address)) How to suppress LeakSanitizer report when running under -fsanitize=address? But it doesn't work for…
Ivan Kush
  • 2,958
  • 2
  • 23
  • 39
0
votes
0 answers

How to suppress alloc-dealloc-mismatch in LeakSanatizer

I'm linking a 3rd party library which uses boost. I get the following error: ==1068324==ERROR: AddressSanitizer: alloc-dealloc-mismatch (INVALID vs operator delete) on 0x603000000688 #0 0x7fce33fb6ce7 in operator delete(void*)…
ventsyv
  • 3,316
  • 3
  • 27
  • 49
0
votes
1 answer

LeakSanitizer doesn't produce report after program exit

I'm compiling with Address Sanitizer, and I'm trying to get leak sanitizer reports, but it is only producing an Address Sanitizer report and not producing a LeakSanitizer report after program exit for some reason. I'm compiling on Centos 7.9 with…
ruisen
  • 305
  • 3
  • 11
0
votes
0 answers

why my program won't stop while using -fsanitize=leak?

I write a simple queue implements by array and when I test it, I faced a wired problem. // vector_queue.h #ifndef TEST_VECTOR_QUEUE_H #define TEST_VECTOR_QUEUE_H #include "linked_queue.h" template class vector_queue { public: …
MrZ
  • 166
  • 1
  • 1
  • 11
0
votes
0 answers

How can I create information leaks in form of memory disclosures? (source code)

I am trying to reproduce the following bug, called information leak which reads the memory from the current process. I am interested in how was done the information leak bug from Foxit in order to leak addresses in userland to reproduce my own test…
xx22111
  • 1
  • 4
0
votes
1 answer

Why LSan (with gcc) doesn't find memory leaks which are allocated by mmap?

I tested it with below code // main.c #include #include #include int main() { int* ptr1 = (int*)malloc(1); int* ptr2 = (int*)mmap(0, 4096*10, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_SHARED, -1, 0); } I…
hyuk myeong
  • 197
  • 1
  • 13
0
votes
0 answers

asan_device_setup.sh error: "No Such File or directory"; But it does exist

I am trying to set up an emulated android device to debug some native code using Google's sanitizers. Upon using the asan_device_setup script required to prepare the device to run sanitized code, the following is comes up: OUTPUT: Peter…
0
votes
0 answers

Can Google's Leak Sanitizer report leaks if the program crashes?

The following program crashes at the null-pointer dereference: #include char *p; int main(void) { p = malloc(42); p = NULL; *p = 0; return 0; } When executed with Valgrind, the memory leak is still reported (despite the…
Alex Zhi
  • 183
  • 5
0
votes
0 answers

Clang fsan not showing line nums in stack trace

Clang++'s leak sanitizer claims I have a memory leak in one of my unit tests. I'm inclined to believe it, but I can't find it by inspection. I'm compiling with the following options: /usr/bin/clang++ -std=c++14 -g -Wall -Wextra -pedantic -O0…
Timtro
  • 418
  • 5
  • 15
1
2