Don't use an uninitialized link on an error path

Arаm Sаrgsyаn requested to merge 4331-resolver.c-assert-uninitialized-link into main

Move the 'cleanup_query' label down to avoid accessing an unitialized link when jumping to that label from 4 different places. The link is initialized only after those jumps happen.

Closes #4331 (closed)

Merge request reports