[PATCH] libbb: Close up a potential DIR leak

Denys Vlasenko vda.linux at googlemail.com
Tue Dec 28 09:29:09 UTC 2010


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.

-- 
vda


More information about the busybox mailing list