Issue #21226: fix a ref leak.
Issue #21226: Merge from 3.4.