Fix some coverity warnings

Merged Beniamino Galvani requested to merge bg/coverity into main

Fix some coverity warnings.

Merge request reports