[PATCH] ls: clean up memory leak

Rich Felker dalias at aerifal.cx
Tue May 2 15:27:50 UTC 2006


On Tue, May 02, 2006 at 09:16:54AM -0600, Shaun Jackman wrote:
> @@ -1151,13 +1149,19 @@
>  			shellsort(dnf, dnfiles);
>  #endif
>  			showfiles(dnf, dnfiles);
> +			if (ENABLE_FEATURE_CLEAN_UP)
> +				free(dnf);
> 		}
>  		if (dndirs > 0) {
>  #ifdef CONFIG_FEATURE_LS_SORTFILES
>  			shellsort(dnd, dndirs);
>  #endif
>  			showdirs(dnd, dndirs, dnfiles == 0);
> +			if (ENABLE_FEATURE_CLEAN_UP)
> +				free(dnd);

Unrelated but I noticed ls.c has its own shellsort function. Could we
remove this and use the libc qsort? It should reduce size (I believe
qsort is already used elsewhere in BB) and possibly improve
performance.

Rich




More information about the busybox mailing list