summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-02 22:57:51 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-08-03 03:01:14 +0000
commit93c9d675afaecc13ef51945d0992037e55b98724 (patch)
tree61a522cc76d6fac37bdec00260c7580853e72707
parent429eedf49e5bc6faaa47392290291e796b473e14 (diff)
downloadrockbox-93c9d675afaecc13ef51945d0992037e55b98724.tar.gz
rockbox-93c9d675afaecc13ef51945d0992037e55b98724.tar.bz2
rockbox-93c9d675afaecc13ef51945d0992037e55b98724.zip
folder_select prevent directory handle leak on error
Change-Id: If1617dc92683d7de3d7709b363a593e40fbc5bc8
-rw-r--r--apps/gui/folder_select.c3
1 files changed, 3 insertions, 0 deletions
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;