Fix misusing iterator.

Fixed http://ci.jubat.us/job/jubatus_core/34/Branch=develop/cppcheckResult/source.22/.