Skip to content
Snippets Groups Projects
Commit c0a83741 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

gc: Don't segfault if gc_realloc() fails.

parent a075741c
No related branches found
No related tags found
No related merge requests found
......@@ -332,6 +332,9 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {
} else {
// TODO check if we can grow inplace
void *ptr2 = gc_alloc(n_bytes);
if (ptr2 == NULL) {
return ptr2;
}
memcpy(ptr2, ptr, n_existing);
gc_free(ptr);
return ptr2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment