News for hackers. Stuff that matters.
Re:The abominable strtok() by jsolson on Friday September 24, 2010 @07:15PM (#1725767)
I wasn't actually talking about error checking, I was talking about the lines:

    char *tok = (char *)malloc(SOMEMEMORY);
    tok = strtok(data, ":");
I don't actually care whether the malloc succeeded or whether or not he checked for an error, as the second line blows away the only reference to the potentially allocated memory. Whatever may or may not have been allocated has now officially been leaked.
Re:The abominable strtok() by tptacek on Friday September 24, 2010 @08:44PM (#1725957)
The cast on that malloc drives me f'ing nuts. DON'T CAST MALLOC.