Fix memory leak
Separate declarations and initializations.