A central limit theorem for functionals of the Kaplan--Meier estimator