Commit cc4e719e authored by Al Viro's avatar Al Viro
Browse files

fix the leak in integrity_read_file()



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7812bf17
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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;