Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15810

Memory leak detected in valgrind

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Laurent Stacul <laurent.stacul@gmail.com>
Newsgroups gnu.bash.bug
Subject Memory leak detected in valgrind
Date Fri, 17 Jan 2020 15:21:31 +0100
Lines 67
Approved bug-bash@gnu.org
Message-ID <mailman.2801.1579272324.1979.bug-bash@gnu.org> (permalink)
References <CAGdu8S+SLmpHN8=q6+xnkA7auruhJh5YD22zZ6jO0GPNnOODrQ@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1579272324 29730 209.51.188.17 (17 Jan 2020 14:45:24 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=hmMGzxAe+UbhNkVqIqETEFP4VBbXCmWHtuf0kOerwgA=; b=Bgv2YeiO5CRpUwAOx8b5ULpZlyu6zkImm4Cc0wIDE+EeWWuqoXzpxMritxRwia/4IQ iq/NL4II5e1PGNXKZKofioXuy/FQgVYKKGwze9roPUSZ+b5OwKU3tVeaGnXWkAjMgKz0 3tZdmHPc/reOPnVwpiYbUXlsQe0pRo1e/udfRPJFDqHAM3R0lkHW8nIAwz3PEfpIPr61 xuZdJwiqc6EcqAPwGAJd706jusCuJPnvWeVyegDTRTYA+RVCQxpYhnmHWoVaAmEE/UQl Y/fIzRjAPvipqASfifswtqOzp6AWCbNK3QNRi0JBImTZ4oYnqeW/Nhxgz7RqAYnMtH9o zFrQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=hmMGzxAe+UbhNkVqIqETEFP4VBbXCmWHtuf0kOerwgA=; b=JCJAchMI9jjum1a2R/6D0xVWcZgCL1B4tIvyu8pozuSCU4UT5j6iABsxQoEaOStTcG V+MWAynedkhkpxkt9pq5mVXrVbJ7moSlOWzk9B4Ye94dnPn55Ei6qIo7xOCiMWnUpKhr FyBQBimjsH2vDjk+mHzfMtS+Xs6zeR8i0mZdYgc/prDKqr4QcfVa/P4TEraIWNXoiOON R8J/BSULB2AQsHIWpgxZ5MKeU16RhtmCmMr0fXXh21cCTDbCPsWxo9eKXQga+83jwyt6 UUOmm9bsAoMaMGNfwOY8KW9bDeg8Q5Y53uBp61qBv9aQeG/gGyaB9jVne76xDIy5vuSz 1+eQ==
X-Gm-Message-State APjAAAUZJb8/exUZGQI3zIav8HZd4+S7wmYkJnboZLEVFylFqG8GbtBv 8P5PzyaYz2r6Z/NnLyPmhmcX6mihB9/TGYAqraZCShl6
X-Google-Smtp-Source APXvYqx/GrUPIFwps5UreduTdnlhhsUuU9udcBe4JfVEvAjNk8s2rVjkV4VwZXIZ7rBhMK1FN7Ml9Q6TG4bwBKdswrc=
X-Received by 2002:ab0:555e:: with SMTP id u30mr21163493uaa.39.1579270903034; Fri, 17 Jan 2020 06:21:43 -0800 (PST)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::92d
X-Mailman-Approved-At Fri, 17 Jan 2020 09:45:22 -0500
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAGdu8S+SLmpHN8=q6+xnkA7auruhJh5YD22zZ6jO0GPNnOODrQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15810

Show key headers only | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Memory leak detected in valgrind Laurent Stacul <laurent.stacul@gmail.com> - 2020-01-17 15:21 +0100

csiph-web