Merge with upstream - Fix memory leak