Fix one more memory leak and a typo error when calling matrix_read()