Fix memory leaks in dynamic message tracking.
Fix use of an uninitialized value.