refactor Mem_Free to clarify types and declarations