powerpc/boot: Only free if realloc() succeeds
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 29 Feb 2024 11:51:49 +0000 (22:51 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Mar 2024 11:20:29 +0000 (22:20 +1100)
commitf2d5bccaca3e8c09c9b9c8485375f7bdbb2631d2
tree75a1ba6879f7fc58d957ac30ee07db88190d402e
parent69b0194ccec033c208b071e019032c1919c2822d
powerpc/boot: Only free if realloc() succeeds

simple_realloc() frees the original buffer (ptr) even if the
reallocation failed.

Fix it to behave like standard realloc() and only free the original
buffer if the reallocation succeeded.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240229115149.749264-1-mpe@ellerman.id.au
arch/powerpc/boot/simple_alloc.c