[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Memory leak detected in valgrind
From: |
Laurent Stacul |
Subject: |
Memory leak detected in valgrind |
Date: |
Fri, 17 Jan 2020 15:21:31 +0100 |
From: Laurent Stacul <laurent.stacul@gmail.com>
To: bug-bash@gnu.org
Subject: Memory leak detected in valgrind
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-A6rPzY/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux docker-for-laurent 5.3.0-26-generic #28-Ubuntu SMP
Wed Dec 18 05:37:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 3
Release Status: release
Description:
Hello dear fellows,
I just spot that redhat GNU/Linux distributions have patched there bash
package since the bash release 4.3:
>cat bash-4.3-memleak-lc_all.patch
diff -up bash-4.3/locale.c.old bash-4.3/locale.c
--- bash-4.3/locale.c.old 2015-07-15 11:55:00.002857301 +0200
+++ bash-4.3/locale.c 2015-07-15 11:48:36.698086257 +0200
@@ -77,8 +77,6 @@ set_default_locale ()
{
#if defined (HAVE_SETLOCALE)
default_locale = setlocale (LC_ALL, "");
- if (default_locale)
- default_locale = savestring (default_locale);
#endif /* HAVE_SETLOCALE */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
And indeed, other distributions like Debian and Ubuntu suffers from a small
memory leak (which has no consequence on a normal end user but have a few
if you use these distributions to build, validate and deliver some C/C++
components).
Repeat-By:
$ env
HOSTNAME=4288543cb792
PWD=/
HOME=/root
TERM=xterm
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
$ valgrind --leak-check=full /bin/bash -c 'exit 0'
...
==565== 2 bytes in 1 blocks are definitely lost in loss record 14 of 269
==565== at 0x483577F: malloc (vg_replace_malloc.c:299)
==565== by 0x195E8D: xmalloc (in /bin/bash)
==565== by 0x18F51A: set_default_locale (in /bin/bash)
==565== by 0x135EE6: main (in /bin/bash)
...
Fix:
I don't know if the provided patch by RedHat people is the good one. You
probably have an opinion on how to fix it properly.
- Memory leak detected in valgrind,
Laurent Stacul <=