| 436 | } |
| 437 | |
| 438 | void lua_free(lua_State *L, void *address) |
| 439 | { |
| 440 | if (nullptr == address || nullptr == L) |
| 441 | return; |
| 442 | auto offset = (intptr_t)address - (intptr_t)L->malloc_buffer; |
| 443 | if (offset < 0 || offset > LUA_MALLOC_TOTAL_SIZE) |
| 444 | return; |
| 445 | size_t offset_size = (size_t)offset; |
| 446 | for (auto it = L->malloced_buffers->begin(); it != L->malloced_buffers->end(); ++it) |
| 447 | { |
| 448 | if (it->first == offset_size) |
| 449 | { |
| 450 | L->malloced_buffers->erase(it); |
| 451 | return; |
| 452 | } |
| 453 | } |
| 454 | } |
no test coverage detected