correct minor issues found by scan-build

Some minor corrections to issues scan-build picked up - a few double assignments, a short section of redundant code