P2P: Fix NULL pointer dereference with SD query cancellation