Skip to content

Commit

Permalink
powerpc/nvram: Add missing kfree in error path
Browse files Browse the repository at this point in the history
If 'nvram_write_header' fails, then 'new_part' should be freed, otherwise,
there is a memory leak.

Signed-off-by: Christophe Jaillet <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
tititiou36 authored and mpe committed Oct 2, 2015
1 parent 2adc48a commit 7d52318
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/kernel/nvram_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@ loff_t __init nvram_create_partition(const char *name, int sig,
if (rc <= 0) {
pr_err("nvram_create_os_partition: nvram_write_header "
"failed (%d)\n", rc);
kfree(new_part);
return rc;
}
list_add_tail(&new_part->partition, &free_part->partition);
Expand Down

0 comments on commit 7d52318

Please sign in to comment.