coverity#1242430 Dereference after null check

Change-Id: If1c59d6d06a9e4601731f13a69b1ac2603c0014b
coverity#982180 Unchecked return value

Change-Id: Ida858f633f1e9afcc1a5a06f503f0ab06d2d3e74
coverity#735315 Unchecked return value

Change-Id: If2e8d3cfe49a039cc27035ae9c0f037c2d60b122
coverity#1242918 Untrusted loop bound

Change-Id: I8575a43a095165a81417f169463aaf2c4ab337e8
coverity#1242791 Untrusted loop bound

Change-Id: Iba6d6b77fe30e11f50e16c1ee899b71ea4337355
coverity#1242739 Untrusted loop bound

and

coverity#1242739 Untrusted loop bound

Change-Id: I2cab9b3c531befc42c1522dd0d4beb59df7ae315