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);
|
mem_real_use += (sizeof(uintptr_t) * roots_size);
|
||||||
|
|
||||||
memcpy((void *)naya, (void *)roots,
|
if (roots) {
|
||||||
sizeof(uintptr_t) * roots_count);
|
memcpy((void *)naya, (void *)roots,
|
||||||
|
sizeof(uintptr_t) * roots_count);
|
||||||
if (roots)
|
|
||||||
free_managed(roots);
|
free_managed(roots);
|
||||||
|
}
|
||||||
|
|
||||||
roots = naya;
|
roots = naya;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user