4 / 4
Nov 2024

LeakSanitizer is showing a SASL leak at shutdown. Low priority I’d think, but annoying to filter when diagnosing a process:
`
==29830==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 192 byte(s) in 1 object(s) allocated from:
#0 0x60b40975e86f in malloc (/home/user/folder/proc/build/bin/proc+0x10b386f)
#1 0x7c5880f10a07 ()
#2 0x7c5880f1118e ()
#3 0x7c58829b1529 in sasl_client_add_plugin (/lib/x86_64-linux-gnu/libsasl2.so.2+0xb529)
#4 0x7c58829b7a20 (/lib/x86_64-linux-gnu/libsasl2.so.2+0x11a20)
#5 0x7c58829b38ae in sasl_client_init (/lib/x86_64-linux-gnu/libsasl2.so.2+0xd8ae)
#6 0x7c5882bd07a7 in _mongoc_do_init (/usr/local/lib/libmongoc-1.0.so.0+0x6a7a7)
#7 0x7c5882bd0a0a in mongoc_init (/usr/local/lib/libmongoc-1.0.so.0+0x6aa0a)
`
There are other objects in sasl_client_add_plugin that are reported as leaked as well.
This is on mongo-c-driver-1.27.5, compiled and run on Ubuntu 24.04.1 LTS

Thanks for the report.

  • Can you share minimal piece of code that successfully reproduces this?
  • Are you able to reproduce it on the latest version as well (1.28.1)?

I haven’t built/installed the latest yet (one release off), but reproducing is pretty straightforward:

#include <libmongoc-1.0/mongoc/mongoc.h> int main(int argc, char** argv) { mongoc_init(); mongoc_cleanup(); return 0; }
g++ -g -O0 -static-libasan -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 main.cpp -Wl,-s -L/usr/local/lib/libmongoc-1.0 -lmongoc-1.0 -o main
./main

Leaks printed here.