forse il problema è dovuto al fatto che malloc assegna un tot di memoria,
ma non è divisa in qualcosa tipo out[0][], out[1][], out[2][] ecc...