cppcheck performance fixes in addons/

This issue fixes performance issues in the addons/ source dir. Other paths will probably follow in the future.
These two are mixed. Imo you should split it to a separate commit. Something like "check return value".
(Sorry overlooked them before)