Fix some leaks and ease running under ASAN

See individual commits for details.

Merge request reports

Loading