Memory leak solved in pub