In the following function designed to free some memory allocated to a pointer of type Maze
with Maze
being a struct I defined in another file.
I am getting the compiler error nonnull argument 'maze' compared to NULL
This is just a warning but I am constrained to leave the warning turned on.
Here is the code for the function:
void free_maze(Maze *maze) {
if (maze == NULL) {
return;
}
free(maze);
return;
}
As I understood, this is the correct way to check if a pointer to a struct is NULL. What am I doing wrong here?