Smarter way to handle typecasting in Tls_Free()