c – Unable to free char-pointer element of a struct when the string reaches a certain length

c – Unable to free char-pointer element of a struct when the string reaches a certain length

You may try to remove the memory allocation for

       t->name 

and change it to

     t->name=ts;

Also, you have to remove the command

    strcpy(t->name,ts);

because that job is performed by the previous command. Then it should give you
no errors.
As far as the TKDestroy(..) you can include the command you commented that is the

    free(tk); 

Hope these help.

c – Unable to free char-pointer element of a struct when the string reaches a certain length

Leave a Reply

Your email address will not be published. Required fields are marked *