Fix chip memory leakage.