RELIABILITY: Fix memory leaks and dereferences of uninitialized pointers.