fixes memory leaks (in kutil.cc when implementing product criterion)