resolve memory leak due to duplicating strings, and replaced dupstr() with strdup()
Merge pull request #6 from MagicalTux/master

resolve memory leak due to duplicating strings