[general] Fixed crash in memory allocator
Fixed a bug in sbrk(). When the new mem_brk value returned by sbrk_no_zero() returns NULL to indicate 'out of memory', sbrk() still memset()s innocent memory at address NULL. For some architectures this memory might be empty, so this never causes a problem. Anyway on Coldfire I still have my vector table there. Nuking them isn't really a good idea :-) Signed-off-by: Carsten Schlote <c.schlote@konzeptpark.de>
This commit is contained in:
parent
0dd247729a
commit
7538c06300
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue