coverity#1258449 Explicit null dereferenced

Change-Id: I531a6ddd744f83ef345c0de8f8c112f61d56925e
coverity#1242939 Untrusted loop bound

Change-Id: Id76a90cf61023fb2dbc276d54ab6f0ec63e25f9f
coverity#1242937 Use of untrusted scalar value

Change-Id: I0eeb35900b1c9c9fbd2889a653a3d042fb171bfd
coverity#1242875 Untrusted loop bound

Change-Id: I5ba34dca7d9f510981b85a35c056c792159f5f98
coverity#704150 Resource leak in object

and

coverity#704151 Resource leak in object
coverity#704152 Resource leak in object

Change-Id: I68c455adc25375b8027236fd44d99a397e372994
coverity#704777 Explicit null dereferenced

Change-Id: Ia9a3a45183b7aa8367b3146061bde5036bcd8cfe