Merge "fix fd leaking and deallocation freed resource"