List iterators should conform to upstream discussion. List iterators that
reach end of list do not point to NULL but rather they point to list_head.
Dereferencing the iterator in this case would break the list. The scope of
the list iterator should be confined to the loop. Solution is to use assign
ptr to iterator when condition is met, this ptr can be used outside of the
loop.
Change-Id: I896b85bbd24b63e6b1562d35ffec8abc920f1b6d
CRs-Fixed: 3331681