folder_select prevent directory handle leak on error

Change-Id: If1617dc92683d7de3d7709b363a593e40fbc5bc8
This commit is contained in:
William Wilgus 2021-08-02 22:57:51 -04:00 committed by William Wilgus
parent 429eedf49e
commit 93c9d675af

View file

@ -165,7 +165,10 @@ static struct folder* load_folder(struct folder* parent, char *folder)
}
char *name = folder_alloc_from_end(len+1);
if (!name)
{
closedir(dir);
return NULL;
}
memcpy(name, (char *)entry->d_name, len+1);
child_count++;
first_child = name;