Fix region file sector overwrite problem

In the get free section function the length of current empty section was
not being reset when a non-empty sector was encountered. This caused the
free section length to appear larger than it actually was.