I've searched far and wide and found no answers, so the best option is to ask my own question. I'm currently doing an assignment for university which requires us to build a node that has a key and value string.
I structured the following node, alongside the following two functions:
typedef struct node_t
{
char *key;
char *data;
} * Node;
Node nodeCreate()
{
Node node = NULL;
node = malloc(sizeof(Node));
if (node == NULL)
return NULL;
node->key = NULL;
node->data = NULL;
return node;
}
void nodeDestroy(Node node)
{
if (node == NULL)
return;
if (node->key != NULL)
free(node->key);
if (node->data != NULL)
free(node->data);
free(node);
}
However, the code above gives me the following error:

Now, this is the plot twist. If I remove the code for the data, the code works fine and valgrind does not give any issues.
I can't find any fixes for this, and it's holding me up on a big assignment, and I don't know what to do. Any help is appreciated.