Skip to content

Commit 5fff54a

Browse files
Standard compliant std::realloc (#22)
1 parent c4ac1d3 commit 5fff54a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/wrenbind17/vm.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ namespace wrenbind17 {
114114

115115
#if WREN_VERSION_NUMBER >= 4000 // >= 0.4.0
116116
data->config.reallocateFn = [](void* memory, size_t newSize, void* userData) -> void* {
117+
if (newSize == 0) {
118+
std::free(memory);
119+
return nullptr;
120+
}
117121
return std::realloc(memory, newSize);
118122
};
119123
data->config.loadModuleFn = [](WrenVM* vm, const char* name) -> WrenLoadModuleResult {

0 commit comments

Comments
 (0)