how to fix the code
#include "friends.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

/*
 * Create a new user with the given name.  Insert it at the tail of the list
 * of users whose head is pointed to by *user_ptr_add.
 *
 * Return:
 *   - 0 if successful
 *   - 1 if a user by this name already exists in this list
 *   - 2 if the given name cannot fit in the 'name' array
 *       (don't forget about the null terminator)
 */
int create_user(const char *name, User **user_ptr_add) {
    if (strlen(name) >= MAX_NAME) {
        return 2;
    }

    User *prev = NULL;
    User *curr = *user_ptr_add;
    while (curr != NULL) {
        if (strcmp(curr->name, name)) {
            return 1;
        }
        prev = curr;
        curr = curr->next;
    }
    User *new_user_ptr = malloc(sizeof(User));
    User new_user;
    strncpy(new_user.name, name, MAX_NAME);
    new_user.name[MAX_NAME-1] = '\0';
    new_user.next = NULL;
    new_user.first_post = NULL;

    for (int i = 0 ; i < MAX_FRIENDS ; i++) {
        new_user.friends[i] = NULL;
    }

    *new_user_ptr = new_user;
    prev->next = new_user_ptr;

    return 0;
}
