bug-bash
[Top][All Lists]
Advanced

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

Re: memory leak in read builtin


From: Chet Ramey
Subject: Re: memory leak in read builtin
Date: Thu, 08 Nov 2007 22:43:05 -0500
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Lars Ellenberg wrote:

> Bash Version: 3.1
> Patch Level: 17
> Release Status: release
> 
> (debian etch, bash 3.1dfsg-8)
> 
> Description:
>       aparently I hit a memory leak in the read builtin.
> 
> Repeat-By:
>       yes | bash -c 'ulimit -v 1000; while read a ; do :; done'
> 
>       bash: xmalloc: ../bash/make_cmd.c:99: cannot allocate 2 bytes (0 bytes 
> allocated)
> 
>       note that
>               yes | while read; do :; done
>               yes | while read a b ; do :; done
>       both run "forever".
> 
>       this apears to be only triggered
>       when the number of input fields is larger
>       than the number of variables.
>       
> Fix:
>       I did not check too closely yet,
>       nor did I build a debug version or run it through gdb.
> 
>       But from looking at the code,
>       I suspect that in builtins/read.def:647 ...
>       the allocated temporary space for t is never FREE'd.

That code is quite different in bash-3.2, and the memory leak is gone.

Chet

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

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