c – Valgrind – Invalid write of size 1 for strcpy
c – Valgrind – Invalid write of size 1 for strcpy
You need to malloc one more byte for temp->data
temp->data = malloc(strlen(node2->data)+1);
This is because you need the final byte to store then ‘