mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
Merge branch 'master' of git://git.denx.de/u-boot-ubi
* 'master' of git://git.denx.de/u-boot-ubi: ubifs: Fix memory leak in ubifs_finddir Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
commit
48efe65829
1 changed files with 6 additions and 5 deletions
|
@ -295,6 +295,7 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
|
||||||
struct file *file;
|
struct file *file;
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *dir;
|
struct inode *dir;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
file = kzalloc(sizeof(struct file), 0);
|
file = kzalloc(sizeof(struct file), 0);
|
||||||
dentry = kzalloc(sizeof(struct dentry), 0);
|
dentry = kzalloc(sizeof(struct dentry), 0);
|
||||||
|
@ -336,7 +337,8 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
|
||||||
if ((strncmp(dirname, (char *)dent->name, nm.len) == 0) &&
|
if ((strncmp(dirname, (char *)dent->name, nm.len) == 0) &&
|
||||||
(strlen(dirname) == nm.len)) {
|
(strlen(dirname) == nm.len)) {
|
||||||
*inum = le64_to_cpu(dent->inum);
|
*inum = le64_to_cpu(dent->inum);
|
||||||
return 1;
|
ret = 1;
|
||||||
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Switch to the next entry */
|
/* Switch to the next entry */
|
||||||
|
@ -355,11 +357,10 @@ static int ubifs_finddir(struct super_block *sb, char *dirname,
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (err != -ENOENT) {
|
if (err != -ENOENT)
|
||||||
ubifs_err("cannot find next direntry, error %d", err);
|
ubifs_err("cannot find next direntry, error %d", err);
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
out_free:
|
||||||
if (file->private_data)
|
if (file->private_data)
|
||||||
kfree(file->private_data);
|
kfree(file->private_data);
|
||||||
if (file)
|
if (file)
|
||||||
|
@ -369,7 +370,7 @@ out:
|
||||||
if (dir)
|
if (dir)
|
||||||
free(dir);
|
free(dir);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
|
static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
|
||||||
|
|
Loading…
Add table
Reference in a new issue