Fix warnings detected by Coverity

Change-Id: I3a8f967542645dd49cf9e52a8e1d38df0bbcd47e