Make the fix for bug 8999 actually work

This backports 1cdbb94f which was spotted by cppcheck.
Merge remote-tracking branch 'github/build-bot-2.1.x' into bleeding-edge-2.1.x
2014.11.14-21.00