bundle: fix memory leak spotted by EricV

This commit is contained in:
Adam Sutton 2014-04-17 17:35:30 +01:00
parent de0562cbf8
commit 6df4ddba8e

View file

@ -313,8 +313,7 @@ int fb_scandir ( const char *path, fb_dirent ***list )
/* Direct */
if (dir->type == FB_DIRECT) {
if ((ret = scandir(dir->d.root, &de, NULL, NULL)) != -1) {
if (ret == 0) return 0;
if ((ret = scandir(dir->d.root, &de, NULL, NULL)) > 0) {
*list = malloc(sizeof(fb_dirent*)*ret);
for (i = 0; i < ret; i++) {
(*list)[i] = calloc(1, sizeof(fb_dirent));