Fix memory leak due to SGVector::clone in KNN

This fixes a little part of the leaks pointed out in #1797.