Fix mallocA_i for exception safety