[cppcheck] Fix memory leak.
[cppcheck] Fix out of bounds writes.
Merge pull request #4 from Oppen/master

Some memory related bug-fixes.
Add gitignore file
Fix compile with xcode5 (compiles 64bit only)