diff --git a/apps/gui/folder_select.c b/apps/gui/folder_select.c index f2830fb8fd..706b166941 100644 --- a/apps/gui/folder_select.c +++ b/apps/gui/folder_select.c @@ -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;