Merge "Fix two memory leaks Bug #6408362" into jb-dev