MUMPS, solve and possible memory leaks

You can solve this problem by using the PETSc interface to MUMPS. See this post, replace -pc_type hypre by -pc_type lu (though for simple problems such as heat equations and such, you should definitely use hypre and not MUMPS).