Fix a few issues that I found using the clang sanitizer

Merge request reports

Loading