summaryrefslogtreecommitdiff
path: root/fs/ext4/ext4fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/ext4fs.c')
-rw-r--r--fs/ext4/ext4fs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index dfecfa0b4e8..1727da2dc6d 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -213,7 +213,7 @@ int ext4fs_opendir(const char *dirname, struct fs_dir_stream **dirsp)
if (!dirs)
return -ENOMEM;
dirs->dirname = strdup(dirname);
- if (!dirs) {
+ if (!dirs->dirname) {
free(dirs);
return -ENOMEM;
}
@@ -224,6 +224,8 @@ int ext4fs_opendir(const char *dirname, struct fs_dir_stream **dirsp)
ret = 0;
*dirsp = (struct fs_dir_stream *)dirs;
} else {
+ free(dirs->dirname);
+ free(dirs);
ret = -ENOENT;
}