# About free()

You should not try to free the same pointer again, or free a pointer that was not assigned with a valid memory address.

Also it is safe to call free() on a NULL pointer. free() handles NULL pointers gracefully, and calling free(NULL) does nothing. This means that if a pointer has already been freed, it can be set to NULL to avoid double-freeing, and subsequent calls to free() on the NULL pointer will have no effect.

you should not use free() on a memory block that wasn't created with malloc() (or related functions like calloc() and realloc()). Doing so can result in undefined behavior, as the memory manager may not be able to properly manage the memory block.

**Something i found in someone's code:**

`return (free(ptr), NULL);`

The expression return (free(ptr), NULL) is using the comma operator. The comma operator evaluates both of its operands and returns the value of the second operand.

In this case, it is equivalent to the following code:

`free(ptr);   return NULL;`
