Hi, i'm writing a program and having some major memory problems(segfault in malloc, malloc_consolidate, SIGABRT in kernel_vsyscall bleh), so I figure it has to do with how I'm freeing memory. So I have no idea when to properly free something for example:
Do i free each token after I'm finished with it, or do i free the line after i'm done tokenizing it or something else?Code:char* line; char* token; line =someFunctionThatMallocsAndReturnsAStringOfCrap(); token = strtok(line," "); //blah blah token = strtok(0, " "); //free(line); or free(token);???
thanks