X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fdlmalloc.c;h=2276532da7a8441c500c39b1716e23a2806a8c21;hb=000b6dc6edfcb83c4fff9376f9a2a4af67f3fc83;hp=735b3443e63a556e0af9dbd63f3def0286f85a0a;hpb=bb3bcfa2426cc6a0aecec7270e3ee67ca843a125;p=oweals%2Fu-boot.git diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 735b3443e6..2276532da7 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1515,7 +1515,7 @@ void *sbrk(ptrdiff_t increment) ulong new = old + increment; if ((new < mem_malloc_start) || (new > mem_malloc_end)) - return NULL; + return (void *)MORECORE_FAILURE; mem_malloc_brk = new; @@ -2179,6 +2179,12 @@ Void_t* mALLOc(bytes) size_t bytes; INTERNAL_SIZE_T nb; + /* check if mem_malloc_init() was run */ + if ((mem_malloc_start == 0) && (mem_malloc_end == 0)) { + /* not initialized yet */ + return 0; + } + if ((long)bytes < 0) return 0; nb = request2size(bytes); /* padded request size; */