According to the Allocate string (char*) in another function I have now code like this:
void someFunction(char** string, char** argv) {
*string = (char*)malloc(strlen(argv[2]) + 1);
strcpy(*string, argv[2]);
strcat(*string, ".txt"); //works fine without this
}
int main(int argc, char** argv) {
char *string;
char *string2;
someFunction(&string,argv);
printf("%s",string);
free(string); // freezes here due the strcat
}
After adding strcat to the code from the linked question, it freezes when I try to free my string.