Along the way, fix some logic problems in pgstat_initstats, notably the bogus assumption that malloc returns zeroed memory.