In effetti, devi rivedere questa linea

m =(int**) malloc(m*n*sizeof(int));