Removing some code defects discovered by Coverity. Patch by Hermès Bélusca. See issue #7105 for more details. svn path=/trunk/; revision=56702