Fix several issues and warnings from analyzer tools.
Created attachment 9430 [details] v4-1-test patch
Comment on attachment 9430 [details] v4-1-test patch looks good.
Karolin, please add the patch to 4.1. Thanks!
Pushed to autobuild-v4-1-test.
Pushed to v4-1-test. Closing out bug report. Thanks!