Raw integer pointers were being used for the validator's nvalidations
and nfails values but the memory holding them could be freed before
they ceased to be used. Use reference counted counters instead.
Closes #5239
Merge branch '5239-use-counter-for-nvalidations-and-nfailss' into 'main'