(Merge 3.4) Issue #22338: Fix a crash in the json module on memory allocation
failure.