On 5/15/19 5:46 AM, Andrew Church wrote:
>>> I assume this is a valgrind false positive.
>>
>> That possible. However, the assertion that causes the abort, is part of
>> the malloc.c version (line 934) that ships with bash. I guess that the
>> issue is caused by the fact that bash uses it's own malloc.c, which
>> seems to be incompatible with valgrind.
> 
> The immediate cause of this error (which is indeed a false positive) is
> that Valgrind replaces calls to functions named "malloc" and "free" with
> its own memory management functions, but Bash's "free" (from
> lib/malloc/malloc.c) is renamed to "sh_xfree" by xmalloc.h.  So memory
> allocations from Bash call Valgrind's malloc(), then eventually pass
> that pointer to Bash's custom free(), which naturally gets confused
> because the pointer wasn't returned from the custom malloc() in the same
> file.

There is a longish discussion about this from two years ago:

http://lists.gnu.org/archive/html/bug-bash/2017-04/msg00038.html

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to