summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/misc.c b/common/misc.c
index 6970ab7e6e..920ac49978 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -64,7 +64,9 @@ void *sbrk (ptrdiff_t increment)
{
void *old = sbrk_no_zero(increment);
- memset (old, 0, increment);
+ /* Only clear increment, if valid address was returned */
+ if (old != NULL)
+ memset (old, 0, increment);
return old;
}