Avoid duplicate frees when scanning.
Merge pull request #108 from pjonsson/avoid-free

Avoid duplicate frees when scanning.