> On Monday 27 December 2010 10:02, Lauri Kasanen wrote:
> > Hi
> >
> > find_block_device_in_dir has a potential DIR leak.
> 
>          len = strlen(ap->devpath);
>          rem = DEVNAME_MAX-2 - len;
> -       if (rem <= 0)
> +       if (rem <= 0) {
> +               closedir(dir);
>                  return NULL;
> +       }
> 
> It can be achieved simply by moving this code block up
> before opendir.
> 
> Fixed in git.
> 

That's true, but it would cause worse performance IMHO. Isn't the check for 
being a proper dir more lightweight than the strlen one?
Now there's a strlen done for every file, and then there's the dir check; 
before it was strlen only for the directories.

- Lauri

-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

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

Reply via email to