Fix memory leak for battery tooltips
Instead of returning a const string, that is fed into strdup, tooltip functions are now supposed to return allocated strings. This fixes a memory leak in the battery tooltip. This is used instead of simply freeing the memory in the battery tooltip function, since it also avoids a uselesss strdup().
This commit is contained in:
@@ -304,7 +304,7 @@ void tooltip_copy_text(Area* area)
|
||||
{
|
||||
free(g_tooltip.tooltip_text);
|
||||
if (area && area->_get_tooltip_text)
|
||||
g_tooltip.tooltip_text = strdup(area->_get_tooltip_text(area));
|
||||
g_tooltip.tooltip_text = area->_get_tooltip_text(area);
|
||||
else
|
||||
g_tooltip.tooltip_text = NULL;
|
||||
g_tooltip.area = area;
|
||||
|
||||
Reference in New Issue
Block a user