Fixed deadlock found by Coverity scan.