[PATCH] ls: clean up memory leak

Rich Felker dalias at aerifal.cx
Tue May 2 00:28:40 UTC 2006


On Mon, May 01, 2006 at 05:28:38PM -0400, Rob Landley wrote:
> On Friday 28 April 2006 10:10 am, Shaun Jackman wrote:
> > As per recent discussion. Please apply.
> 
> I'm currently going through my recent messages backwards, sorted by subject 
> (hey, gotta clear the backlog somehow), so I haven't seen the "recent 
> discussion" yet, but glancing at the patch:
> 
> > -	struct dnode *next;	/* point at the next node */
> > +	/* point at the next dnode used in list_dir only
> > +	   and not null if fullname have memory allocated */
> > +	void *allocated;
> 
> That comment's unintelligible.
> 
> > @@ -474,7 +457,11 @@
> >  	} else {
> >  		/* find the longest file name-  use that as the column width */
> >  		for (i = 0; i < nfiles; i++) {
> > +#ifdef CONFIG_FEATURE_UTF8_SUPPORT
> > +			int len = mbchar_len(dn[i]->name) +
> > +#else
> >  			int len = strlen(dn[i]->name) +
> > +#endif
> 
> 
> A) So this is dependent on a patch adding a UTF8 config item?
> 
> B) ICK.  This is the sort of thing platform.h is for, although not having seen 
> the patch I don't know what what exactly would be required.  Some kind of 
> utf8_strlen() macro seems called for, though...

Please be aware that the needed number is the WIDTH, not the string
length in characters... wcwidth/wcswidth is needed or else you might
as well just use strlen since it will be wrong anyway. :)

Rich




More information about the busybox mailing list