[PATCH] ls: clean up

Vladimir N. Oleynik dzo at simtreas.ru
Mon Apr 24 13:28:18 UTC 2006


Shaun,

> ls has an ugly bug. ls uses an array of pointers, the elements of
> which are all in a linked list. To free the elements, instead of
> freeing all the elements in the array, array[0..nelements], it frees
> by iterating the linked list starting at array[0], which it assumes is
> the head of the list. Unfortunately, ls also sorts the array! So,
> array[0] is no longer the head, 

Why? sort have the transposition array elemens without deleting a elements.
After dnode allocate we have set the next field to next elements.
Else countfiles() can`t work.
For me may be have problem in splitdnarray() only.
And showdirs() have memory leak - free first element only.


--w
vodz



More information about the busybox mailing list