The query pointer was detached too early leading to null pointer
reference. Move the query_detach() after the query->canceled check.
(cherry picked from commit 9d8e8a4fcc)
The query pointer was detached too early leading to null pointer
reference. Move the query_detach() after the query->canceled check.
(cherry picked from commit 9d8e8a4fcc)