Coverity defect IDs: 1296295, 1296294 (cherry picked from commit 5745c880fdbaa69de619263884c8f690c2bd044b)