Is there a segmentation fault in this
void add_dependencies(Rule **rules_head, char *line) {

    char *ptr = strtok((char *)line, " :"); // target name

    Rule *curr = *rules_head;
    while (curr->next_rule != NULL) {
        if (strcmp(curr->target, ptr) == 0) {break;}
        else {curr = curr->next_rule;}
    }

    ptr = strtok(NULL, " ");
    while (ptr != NULL) {
        Dependency *new_dep = malloc(sizeof(Dependency));
        new_dep->rule = find_rule(&curr, ptr);

        if (curr->dependencies == NULL) {
                curr->dependencies = new_dep;
                new_dep->next_dep = NULL;
        } else {
                new_dep->next_dep = curr->dependencies;
                curr->dependencies = new_dep;
        }
        ptr = strtok(NULL, " ");
    }
}