Change the Free function

make the pointer point to null after free.