summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/simple_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/boot/simple_alloc.c')
-rw-r--r--arch/powerpc/boot/simple_alloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/powerpc/boot/simple_alloc.c b/arch/powerpc/boot/simple_alloc.c
index 267d6524ca..d07796fdf9 100644
--- a/arch/powerpc/boot/simple_alloc.c
+++ b/arch/powerpc/boot/simple_alloc.c
@@ -112,8 +112,11 @@ static void *simple_realloc(void *ptr, unsigned long size)
return ptr;
new = simple_malloc(size);
- memcpy(new, ptr, p->size);
- simple_free(ptr);
+ if (new) {
+ memcpy(new, ptr, p->size);
+ simple_free(ptr);
+ }
+
return new;
}