Fixed memory leak in q5