From: Christophe Jaillet Date: Fri, 17 Jul 2015 07:19:59 +0000 (+0200) Subject: powerpc/nvram: Add missing kfree in error path X-Git-Tag: firefly_0821_release~176^2~775^2~52 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7d523187173294f6ae3b86a48e442122b1aecc38;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Michael Ellerman --- 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);