Is it a good practice to free memory before exiting the program? I've read many places online that since modern operating systems reclaim all resources before exiting, there's no need to free memory.

Consider the following example:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define NAME_LENGTH 30

int main(void) {
    char *name = malloc(NAME_LENGTH);
    if (name == NULL) {
        fputs("Not enough memory\n", stderr);
        exit(EXIT_FAILURE);
    }
    
    fputs("Enter your name: ", stderr);
    fflush(stderr);
    if (fgets(name, NAME_LENGTH, stdin) == NULL) {
        free(name);
        fputs("Either EOF was encountered and no bytes were read, or an error \
ocurred when reading from standard input\n", stderr);
        exit(EXIT_FAILURE);
    }
    
    char *newline = strchr(name, '\n');
    if (newline != NULL) {
        *newline = '\0';
    }
    
    printf("Hello %s\n", name);
    
    free(name);
    
    return 0;
}
Notice the two calls to free(). One before calling exit() if the fgets() function fails, and the other one before terminating the program.

Now, the latter is pretty simple to make. The former however, can be a little of a hassle especially if there are many aborting sections and memory allocated from different functions. Should I worry about freeing the memory even on complex scenarios?