diff options
| -rw-r--r-- | fs/ubifs/dir.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 40d7b9af7..53e82ace6 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -474,13 +474,14 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) } out: + kfree(file->private_data); + file->private_data = NULL; + if (err != -ENOENT) { ubifs_err("cannot find next direntry, error %d", err); return err; } - kfree(file->private_data); - file->private_data = NULL; /* 2 is a special value indicating that there are no more direntries */ file->f_pos = 2; return 0; |
