bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory leaks in bash-4.4.0


From: Bruce Dubbs
Subject: Re: Memory leaks in bash-4.4.0
Date: Mon, 30 Jan 2017 13:34:49 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39

Chet Ramey wrote:
On 1/29/17 6:48 PM, Bruce Dubbs wrote:

Bash Version: 4.4
Patch Level: 0
Release Status: release

Description:

    When running regression tests on libinput, I get two different leaks
identified by valgrind. The files below are not a part of libinput but are
a part of bash.

What is libinput?

https://www.freedesktop.org/software/libinput/

    ==10733== 11 bytes in 1 blocks are definitely lost in loss record 81 of 290
    ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
    ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
    ==10733==    by 0x469598: set_default_locale (locale.c:81)
    ==10733==    by 0x419950: main (shell.c:411)
    ==10733==

http://lists.gnu.org/archive/html/bug-bash/2015-07/msg00073.html

    ==10733== 17 bytes in 1 blocks are definitely lost in loss record 112 of
290
    ==10733==    at 0x4C2AACD: malloc (vg_replace_malloc.c:299)
    ==10733==    by 0x46F7BD: xmalloc (xmalloc.c:112)
    ==10733==    by 0x4524EA: make_dev_fd_filename (subst.c:5692)
    ==10733==    by 0x4524EA: process_substitute (subst.c:5751)
    ==10733==    by 0x4524EA: expand_word_internal (subst.c:9172)
    ==10733==    by 0x454E33: shell_expand_word_list (subst.c:10565)
    ==10733==    by 0x454E33: expand_word_list_internal (subst.c:10688)
    ==10733==    by 0x42F14E: execute_simple_command (execute_cmd.c:4153)
    ==10733==    by 0x43134B: execute_command_internal (execute_cmd.c:802)
    ==10733==    by 0x432BDD: execute_command (execute_cmd.c:405)
    ==10733==    by 0x41BD51: reader_loop (eval.c:180)
    ==10733==    by 0x41AAAA: main (shell.c:792)

It would help if there were a short reproducer for this, so I can verify
it.

I'll see what I can do.

I was not able to trace everything through, but xmalloc.c:112 does:

   temp = malloc (bytes);

and as best I can tell, temp is never freed.

xmalloc is a malloc wrapper, and `temp' is the return value from the
function.

Yes, I know. The issue is that the caller, in this case set_default_locale or possibly main, never runs free on the allocated space. I tried to trace it in set_default_locale but there are a lot of paths and I didn't follow it all. I'll look some more and get back to you.

  -- Bruce




reply via email to

[Prev in Thread] Current Thread [Next in Thread]