Fixed a memory leak in mxarray