Merge pull request #86 from fryshorts/fixes

Minor fixes for problems reported by valgrind
Use memmove instead of memcpy for potentially overlapping memory

This fixes an issue reported by valgrind where overlapping memory
was copied with memcpy.
This also removes a redundant assignment where the array size was
explicitly set to zero when it was already zero.