cppcheck: fix reassigned vars

Change-Id: I9038045b5756ca956febe5d2ab7b05d15c4a7bca