fixed SHM double-free crash and buffer bug