It sounds (from Valgrind's report) as if method
is NULL
. You should step through this code with a debugger to verify that the tokenizing works as intended.
Also, you should declare all those pointers as const char *
since they're not intended to be written to. This is of course a minor point, but I try to encourage use of const
whenever possible. :)