fixed memory allocation in --attach-daemon2