I\'m trying to create a singly linked list from an input text file for an assignment. I\'m trying to do it a little bit at a time so I know my code is not complete. I trie
The second malloc allocates memory but its return value is not assigned to anything, so that allocated memory is lost.
newList is allocated but not initialized, so using a memcpy to copy memory to newList->str will fail since newList->str points to nothing. Probably you wanted the result of the second malloc to be assigned to newList->str, but you forgot it.