Current-Users archive

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

Re: Recent /bin/sh breakage



David Laight wrote:
> >   UID PID PPID   CPU PRI NI   VSZ   RSS WCHAN   STAT TTY      TIME COMMAND
> >     0 471  344 13031  85  0 27644 23500 wait    S+   tty00 0:01.15 sh 
> > MAKEDEV -MM init 
> 
> Something must be leaking badly :-)

Indeed, and I think I have found the reason for the leak.  The sh
arithmetic expression YACC parser contains a return statement in a
parser action; this is a bad idea because it causes yyparse() to
return without freeing the malloc'ed parser state.  I will commit the
following fix shortly.

Index: src/bin/sh/arith.y
===================================================================
RCS file: /bracket/repo/src/bin/sh/arith.y,v
retrieving revision 1.18
diff -u -r1.18 arith.y
--- src/bin/sh/arith.y  25 Mar 2007 06:29:26 -0000      1.18
+++ src/bin/sh/arith.y  12 Nov 2009 20:00:34 -0000
@@ -83,7 +83,6 @@
                         * the desired result elsewhere.
                         */
                        arith_result = $1;
-                       return 0;
                }
        ;
 
-- 
Andreas Gustafsson, gson%gson.org@localhost


Home | Main Index | Thread Index | Old Index