Switch free with free_matrix when needed in parser.c