why is this not freeing everything?
/* 
 * From the list pointed to by *user_ptr_del, delete the user 
 * with the given name. 
 * Remove the deleted user from any lists of friends. 
 * 
 * Return: 
 *   - 0 on success. 
 *   - 1 if a user with this name does not exist. 
 */  
int delete_user(const char *name, User **user_ptr_del) {  

    User *curr = *user_ptr_del;

    int index1 = 0;
    
    int i = 0;
    int j = 0;

    while(curr != NULL){
            //Delete user friend
            while(i < MAX_FRIENDS - 1 && curr->friends[i] != NULL){
                while(j < MAX_FRIENDS - 1 && curr->friends[i]->friends[j] != NULL){
                    if(strcmp(curr->friends[i]->friends[j]->name, name) == 0){
                        index1 = j;
                    }
                    j++;   
                }
                curr->friends[i]->friends[index1] = curr->friends[i]->friends[j - 1];
                curr->friends[i]->friends[j - 1] = NULL;
                i++;
            }
        curr = curr->next;
    }

    User *curr2 = *user_ptr_del;
    User *prev = NULL;
    Post *bye = NULL;

    while(curr2 != NULL){
        
        if(strcmp(name, curr2->name)==0){
            Post *p = curr2->first_post;

            while(p != NULL){
                free(p->date);
                free(p->contents);
                bye = p;
                p = p->next; 
                free(bye);
            }

            curr2->first_post = NULL;

            if(prev ==NULL){
                *user_ptr_del = curr2->next;
            }else{
                prev->next = curr2->next;
            }
            free(curr2);
            return 0;
        }
        prev = curr2;
        curr2 = curr2->next;
    }
       
    return 1;
}  