Fixed parsing with strtok - no malloc errors

Thank god for glibc and valgrind
Main leaks found and fixed

again thank you valgrind.
there are more "errors"