Remove one unused variable and initialize the top event pointer.
Correct deleting of pointers in tests.