Fixing memory leaks in NCBM solver.

Your order, Mr. @vigsterkr.