Coverity defect IDs: 1316687, 1316688 (cherry picked from commit 51a2a3fa93702f289cda1e64323f55aba02f1026)