Fix mem-alloc for msm