Fix mem leaks query catalog

(Valgrind error count for workers is now zero.)