mem: fix pointer pointer aliasing violations