Fix various scan-build warnings
See the commit messages. These commits fix various warnings from scan-build (which you can see in the most recent scan-build CI run). I don’t think any of the warnings are bugs which would actually be hit in practice. I’ve filed !2627 (merged) for one memory leak scan-build found which could be hit in practice. There are still more scan-build warnings to investigate.
Signed-off-by: Philip Withnall pwithnall@endlessos.org
Helps: #1767 (closed)