fix the leak in integrity_read_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7812bf173a
commit
cc4e719e83
|
@ -234,12 +234,13 @@ int __init integrity_read_file(const char *path, char **data)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = integrity_kernel_read(file, 0, buf, size);
|
rc = integrity_kernel_read(file, 0, buf, size);
|
||||||
if (rc < 0)
|
if (rc == size) {
|
||||||
kfree(buf);
|
|
||||||
else if (rc != size)
|
|
||||||
rc = -EIO;
|
|
||||||
else
|
|
||||||
*data = buf;
|
*data = buf;
|
||||||
|
} else {
|
||||||
|
kfree(buf);
|
||||||
|
if (rc >= 0)
|
||||||
|
rc = -EIO;
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
fput(file);
|
fput(file);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue