On 2014年12月24日 13:53, Rich Felker wrote:
On Wed, Dec 24, 2014 at 10:32:19AM +0800, yhu2 wrote:
The script which triggers the leak:

while true
   do
     while true
       do
         break;
     done</dev/null
done

someone had fixed this bug, the commit is:
http://git.busybox.net/busybox/commit/shell/ash.c?id=4ba6c5d3ba3d2c7922aff6b5c2e73b8325f1cf17

but this commit results in crash running some shell scripts, so it was reverted.


I am trying to resolve this defect,any commnent would be appreciated!

There is no easy fix. The patch you sent is incorrect. The problem is
that the "stack model" used for allocation in ash is semantically
wrong, and needs to be replaced with a dependency-tree model or
something else that can handle freeing one object without freeing all
subsequently-allocated objects.

As a workaround, it might be possible to code a hack to reuse the
existing copy of the string on the allocation stack rather than
allocating a new copy whenever an existing copy already exists. This
would not solve the general case (e.g. when the redirection uses a
different file on each iteration) but it would solve the case above, I
think. It might be worth pursuing this approach if nobody is available
to work on the proper fix in the near future.


Hi Rich Felker:

Could you submit your suggested workaround?

-Roy


Rich
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox



--
Best Reagrds,
Roy | RongQing Li
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to