Closed rbuj closed 2 years ago
@rbuj How can i reproduce the memleaks for myself?
You just have to run mate-screensaver-preferences on a terminal with AddressSanitizer enabled, adding -fsanitize=address
in CFLAGS. You can use gcc 4.9+ or clang.
The allocated memory for the variable text
in gtk_tree_model_get (model, iter, column, &text, -1);
, it must be freed since its value is "__separator"
.
@rbuj
Hmm, looks like something is missing here. Compiling doesn't work with -fsanitize=address
enabled.
[rave@mother mate-screensaver-dist]$ CFLAGS="-ggdb3 -O0 -fsanitize=address" LDFLAGS="-fsanitize=address" ./autogen.sh --prefix=/usr/local && make && sudo make install
/usr/bin/mate-autogen
checking for autoreconf >= 2.53...
testing autoreconf... found 2.69
checking for pkg-config >= 0.14.0...
testing pkg-config... found 1.7.3
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running autoreconf...
autoreconf: Entering directory `.'
autoreconf: running: autopoint --force
autoreconf: running: aclocal --force --warnings=no-portability -I m4 ${ACLOCAL_FLAGS}
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force --warnings=no-portability
autoreconf: running: /usr/bin/autoheader --force --warnings=no-portability
autoreconf: running: automake --add-missing --copy --force-missing --warnings=no-portability
configure.ac:18: installing './compile'
configure.ac:11: installing './missing'
helper/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
Running ./configure --enable-maintainer-mode --prefix=/usr/local ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether to enable debugging... no
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/media/Data/Programme/Linux/Mate-Desktop/git-version/github-matedesktop/mate-screensaver-dist':
configure: error: C compiler cannot create executables
See `config.log' for more details
[rave@mother mate-screensaver-dist]$ rpm -qa gcc
gcc-11.2.1-9.fc34.x86_64
[rave@mother mate-screensaver-dist]$
Edit:
Same with using CFLAGS="-fsanitize=address" ./autogen.sh --prefix=/usr/local && make && sudo make install
OK, libasan
was missing in my installation. Now compiling with -fsanitize=address
works.
I can confirm that this warning is gone.
Direct leak of 312 byte(s) in 26 object(s) allocated from:
#0 0x7f770b2a691f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
#1 0x7f770a28a938 in g_malloc (/lib64/libglib-2.0.so.0+0x5d938)