Fix undefined behavior when destroying a search context