And yes, those ifs are not necessary as `free` will check if the pointer is already NULL before freeing it.