added xfree (extended free), sets pointer to NULL