diff --git a/src/gallium/auxiliary/hud/hud_sensors_temp.c b/src/gallium/auxiliary/hud/hud_sensors_temp.c index e41b847..8161ae7 100644 --- a/src/gallium/auxiliary/hud/hud_sensors_temp.c +++ b/src/gallium/auxiliary/hud/hud_sensors_temp.c @@ -194,10 +194,14 @@ free_query_data(void *p) { struct sensors_temp_info *sti = (struct sensors_temp_info *) p; list_del(&sti->list); + gsensors_temp_count--; if (sti->chip) sensors_free_chip_name(sti->chip); FREE(sti); - sensors_cleanup(); + + /* Destroy sensor singleton only after all refs released. */ + if (!gsensors_temp_count) + sensors_cleanup(); } /**