dlmalloc: ensure gd is set for early alloc
[oweals/u-boot.git] / common / dlmalloc.c
index f9873393c183350795ed3ac7c15f5552afb5419b..d87834df67f4f94d6f71951be8880e80a28fb904 100644 (file)
@@ -2181,7 +2181,7 @@ Void_t* mALLOc(bytes) size_t bytes;
   INTERNAL_SIZE_T nb;
 
 #ifdef CONFIG_SYS_MALLOC_F_LEN
-       if (!(gd->flags & GD_FLG_RELOC)) {
+       if (gd && !(gd->flags & GD_FLG_RELOC)) {
                ulong new_ptr;
                void *ptr;