state_tracker: Guard against a possible calloc failure and fix state_tracker_free



Checks if the passed in tracker is actually valid before attempting to free its members.