fixed memalloc matrix dim in main.c