The check for NULL is not necessary before free.