summaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/nvram_64.c
diff options
context:
space:
mode:
authorChristophe Jaillet <christophe.jaillet@wanadoo.fr>2015-07-17 09:19:59 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2015-10-02 22:54:55 +1000
commit7d523187173294f6ae3b86a48e442122b1aecc38 (patch)
tree2446488fa1dc54398b339fde49912352c60d8f4b /arch/powerpc/kernel/nvram_64.c
parent2adc48a691866fbb3134dd3abd77647a8b5a9307 (diff)
powerpc/nvram: Add missing kfree in error path
If 'nvram_write_header' fails, then 'new_part' should be freed, otherwise, there is a memory leak. Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/nvram_64.c')
-rw-r--r--arch/powerpc/kernel/nvram_64.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 98ba106a59ef..72858e926e0a 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -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);