#4305 fixes leak memory.