Fix a use-after-free condition in spellcheck request

cherry pick c713736b122c2224804b2db72f1f711cb47ee260 from upstream