Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christophe Jaillet and committed by
Michael Ellerman
7d523187 2adc48a6

+1
+1
arch/powerpc/kernel/nvram_64.c
··· 1079 1079 if (rc <= 0) { 1080 1080 pr_err("nvram_create_os_partition: nvram_write_header " 1081 1081 "failed (%d)\n", rc); 1082 + kfree(new_part); 1082 1083 return rc; 1083 1084 } 1084 1085 list_add_tail(&new_part->partition, &free_part->partition);