Sure I agree it is better to pass the pointer as an argument, but if so why don't you make the it's scope this function only.