I want args to be array of strings stored on the heap, however args[0] is being written over some reason in the while loop
void set_action(Rule *rule_block, char *action_line){
    int num_tokens = find_num_tokens(action_line);
    char **args = malloc(sizeof(char) * (num_tokens + 1)); // an extra for NULL at the end
    args[num_tokens] = NULL;
    int i = 0;

    printf("action line is: '%s'\n", action_line);
    char *token = strtok(action_line, " ");
    while (token != NULL){
        args[i] = malloc(sizeof(char) * (strlen(token) + 1));
        char *heap_token = args[i];
        
        strncpy(heap_token, token, strlen(token));
        heap_token[strlen(token)] = '\0';        
        printf("Token is %s\n", heap_token);
        i++;
        token = strtok(NULL, " ");
        printf("%s\n", args[0]);
    }

    Action *new_action = malloc(sizeof(Action));
    new_action->args = args;
    new_action->next_act = NULL;

    if (rule_block->actions == NULL){
        rule_block->actions = new_action;
        return;
    }
    
    Action *curr_action = rule_block->actions;
    while (curr_action->next_act != NULL){
        curr_action = curr_action->next_act;
    }
    curr_action->next_act = new_action;
	return;
}