Commit cc4e719e authored by Al Viro's avatar Al Viro

fix the leak in integrity_read_file()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7812bf17
......@@ -234,12 +234,13 @@ int __init integrity_read_file(const char *path, char **data)
}
rc = integrity_kernel_read(file, 0, buf, size);
if (rc < 0)
if (rc == size) {
*data = buf;
} else {
kfree(buf);
else if (rc != size)
if (rc >= 0)
rc = -EIO;
else
*data = buf;
}
out:
fput(file);
return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment