thermal: core: fix some possible name leaks in error paths
This is an automated ID intended to aid in discovery of potential security vulnerabilities. The actual impact and attack plausibility have not yet been proven. This ID is fixed in Linux Kernel version v5.15.86 by commit 5139cbc0c6e4bf2fcffc9a7ed4350bf6985bc561, it was introduced in version v5.15.3 by commit 38ef472ca8e59c971984922ad3b60d5338c16deb. For more details please see the references link.