sanitize memory allocations