avoid NULL argument to memcpy()
gcc 4.9 takes advantage of the specification of undefined behavior if you pass a NULL to memcpy(), even if the last argument is 0
This commit is contained in:
parent
3c8b5b672e
commit
df375daef4
|
@ -1653,11 +1653,11 @@ void GC_add_roots(void *start, void *end)
|
|||
|
||||
mem_real_use += (sizeof(uintptr_t) * roots_size);
|
||||
|
||||
memcpy((void *)naya, (void *)roots,
|
||||
sizeof(uintptr_t) * roots_count);
|
||||
|
||||
if (roots)
|
||||
if (roots) {
|
||||
memcpy((void *)naya, (void *)roots,
|
||||
sizeof(uintptr_t) * roots_count);
|
||||
free_managed(roots);
|
||||
}
|
||||
|
||||
roots = naya;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user