why does this give me segmentation fault?
while (curr->dependencies != NULL) {
    curr->dependencies = curr->dependencies->next_dep;
}

r = malloc(sizeof(Rule));
r->target = strdup(token);
r->actions = NULL;
r->next_rule = NULL;
dep->next_dep = NULL;
dep->rule = r;
curr->dependencies = dep;
printf("%s\n", curr->dependencies->next_dep->rule->target);
}
}