mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
pstore: Fix leaked pstore_record in pstore_get_backend_records()
When the "if (record->size <= 0)" test is true in pstore_get_backend_records() it's pretty clear that nobody holds a reference to the allocated pstore_record, yet we don't free it. Let's free it. Fixes: 2a2b0acf768c ("pstore: Allocate records on heap instead of stack") Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Cc: stable@vger.kernel.org
This commit is contained in:
parent
4a16d1cb24
commit
f6525b96dd
@ -849,8 +849,10 @@ void pstore_get_backend_records(struct pstore_info *psi,
|
||||
record->size = psi->read(record);
|
||||
|
||||
/* No more records left in backend? */
|
||||
if (record->size <= 0)
|
||||
if (record->size <= 0) {
|
||||
kfree(record);
|
||||
break;
|
||||
}
|
||||
|
||||
decompress_record(record);
|
||||
rc = pstore_mkfile(root, record);
|
||||
|
Loading…
x
Reference in New Issue
Block a user