Well it looks like snode[count - 1].data
is never initialized. Only the first index snode[0].data
is allocated
I think you should replace
snode->data = (struct stock_data *) malloc(sizeof(struct stock_data));
if (snode->data == NULL) { abort(); }
By
snode[count - 1].data = (struct stock_data *) calloc(1, sizeof(struct stock_data));
if (snode[count - 1].data == NULL) { abort(); }