[PD] fixes for two memory leaks