Closed sebholt closed 1 month ago
LGTM But since this code was just recently introduced by @jengelh, I would like to get his opinion before merging.
Ok. I've updated the PR description to make the issue more clear.
It's a sound argument.
Thanks both of you!
Pull Request Type
Description
Currently
mem_rmalloc
usesstd::malloc
for memory allocation and the deallocation is performed inmem_free
which calls::free
. This does seem to work but is undefined behavior because memory allocated withstd::malloc
should be freed withstd::free
not::free
.We should use either
::malloc
and::free
, orstd::malloc
andstd::free
.The
mem_malloc/mem_free
functions already use the C interface so it makes sense to letmem_rmalloc
simply callmem_malloc
instead ofstd::malloc
directly. There's also no speed difference because everything is inline or a macro.This changes the
mem_rmalloc
function to callmem_malloc
instead ofstd::malloc
to match themem_free
call.Related Issues
Screenshots (if applicable)
Checklist
Additional Comments