summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/misc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/common/misc.c b/common/misc.c
index 30631182d3..ab7a53e93f 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -14,12 +14,9 @@ void mem_malloc_init (void *start, void *end)
mem_malloc_start = (ulong)start;
mem_malloc_end = (ulong)end;
mem_malloc_brk = mem_malloc_start;
-
- memset ((void *) mem_malloc_start, 0,
- mem_malloc_end - mem_malloc_start);
}
-void *sbrk (ptrdiff_t increment)
+void *sbrk_no_zero(ptrdiff_t increment)
{
ulong old = mem_malloc_brk;
ulong new = old + increment;
@@ -27,11 +24,22 @@ void *sbrk (ptrdiff_t increment)
if ((new < mem_malloc_start) || (new > mem_malloc_end)) {
return (NULL);
}
+
+ memset ((void *)old, 0, increment);
mem_malloc_brk = new;
return ((void *) old);
}
+void *sbrk (ptrdiff_t increment)
+{
+ void *old = sbrk_no_zero(increment);
+
+ memset (old, 0, increment);
+
+ return old;
+}
+
int errno;
#ifndef CONFIG_ERRNO_MESSAGES