From c9fbdfbbbe7ea7c17eb4a04f204b058d46876f0d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 20 Apr 2021 06:12:42 -1000 Subject: [PATCH] Fix memory leak in heos (#49461) --- homeassistant/components/heos/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/heos/__init__.py b/homeassistant/components/heos/__init__.py index a71d0d2de50..a4db978a39d 100644 --- a/homeassistant/components/heos/__init__.py +++ b/homeassistant/components/heos/__init__.py @@ -82,7 +82,9 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): async def disconnect_controller(event): await controller.disconnect() - hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, disconnect_controller) + entry.async_on_unload( + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, disconnect_controller) + ) # Get players and sources try: