Free unused nvpairs from catalog_query.
Free master's list in query cache
Merge pull request #551 from btovar/mem_leaks_query_catalog

Fix mem leaks query catalog