fix a leak in kmp