Skip to content

Commit

Permalink
Fix memory violation (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunexgeek committed Apr 13, 2020
1 parent 2a70ae8 commit 7f6f17c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gc.c
Expand Up @@ -29,7 +29,7 @@
#define GC_TAG_ROOT 0x1
#define GC_TAG_MARK 0x2

/*
/*
* Support for windows c compiler is added by adding this macro.
* Tested on: Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314 for x86
*/
Expand Down Expand Up @@ -446,8 +446,9 @@ void* gc_realloc(GarbageCollector* gc, void* p, size_t size)
alloc->size = size;
} else {
// successful reallocation w/ copy
void (*dtor)(void*) = alloc->dtor;
gc_allocation_map_remove(gc->allocs, p, true);
gc_allocation_map_put(gc->allocs, q, size, alloc->dtor);
gc_allocation_map_put(gc->allocs, q, size, dtor);
}
return q;
}
Expand Down

0 comments on commit 7f6f17c

Please sign in to comment.