why does this code result in segmentation fault?
Rule *parse_file(FILE *fp) {
    // Implement this function and remove the stubbed return statement below.
        int count;
	char *placeholder = malloc(sizeof(char)*MAXLINE);
        char *line = fgets(placeholder, MAXLINE, fp);
	Rule *curr = malloc(sizeof(Rule));
	Rule *head = curr;
	int com_count=0; 
	int act = 0;
	char **tab; 
        while (line != NULL){
        if (is_comment_or_empty(placeholder)){
                line = fgets(placeholder, MAXLINE, fp);
        continue;
        }
        char *target = malloc(sizeof(char)*MAXLINE);
    	char *colon = strchr(placeholder, ':');
    	Action *acurr;
        if (colon != NULL){
        act = 0;
        strncpy(target, placeholder, colon - line-1);
        target[colon-line-1] = '\0';
        
        strcpy(curr->target, target);
        curr -> next_rule = malloc(sizeof(Rule));
        curr = curr->next_rule;
        char *dep = colon + 2;
        char *tok = strtok(dep, " ");

        count = 0;
        while (tok != NULL){
        tab[com_count][count] = *tok;
        tok = strtok(NULL, " ");
        count += 1;
        
        }
        tab[com_count][count] = '\0';

        }
        else{
        
        if (act==0){
        act = 1;
        acurr = malloc(sizeof(Action));
        char *tok = strtok(placeholder, " ");
        int index = 0;
        while (tok != NULL){
        
        (acurr -> args)[index] = tok;
        tok = strtok(NULL, " ");
        index ++;
        
        }
        
        (acurr -> args)[index] = NULL;
        

        }
        
        else{
        
        Action *next = malloc(sizeof(Action));
        char *tok = strtok(placeholder, " ");
        int index = 0;
         while (tok != NULL){
         (next->args)[index] = tok;
         tok = strtok(NULL, " ");
         index ++;
         
         }
         
        (acurr -> args)[index] = NULL;
        acurr->next_act = next;
        acurr = acurr->next_act;
        
        }
        
        
        
        }
        
        com_count ++;
        free(target);
        line = fgets(placeholder, MAXLINE, fp);
        }
        Rule *cur = head;
        com_count = 0;
	while (cur != NULL){
	count = 0;
	
	
	while (tab[com_count][count] != '\0'){
	Rule *inner_curr = head;
	Dependency *dep_cur = malloc(sizeof(Dependency));
	while (inner_curr != NULL){
	if(strcmp(inner_curr->target, &tab[com_count][count]) == 0){
        dep_cur->rule = inner_curr;
        dep_cur->next_dep = malloc(sizeof(Dependency));
        dep_cur = dep_cur->next_dep;
	
	}
	inner_curr = inner_curr->next_rule;
	}
	count ++; 
	}
	com_count ++; 
	cur = cur->next_rule;
	}   
    return head;
}
