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:
@@ -347,10 +347,10 @@ void launcher_icon_on_change_layout(void *obj)
|
||||
launcherIcon->area.height = launcherIcon->icon_size;
|
||||
}
|
||||
|
||||
const char* launcher_icon_get_tooltip_text(void *obj)
|
||||
char* launcher_icon_get_tooltip_text(void *obj)
|
||||
{
|
||||
LauncherIcon *launcherIcon = (LauncherIcon*)obj;
|
||||
return launcherIcon->icon_tooltip;
|
||||
return strdup(launcherIcon->icon_tooltip);
|
||||
}
|
||||
|
||||
void draw_launcher_icon(void *obj, cairo_t *c)
|
||||
|
||||
Reference in New Issue
Block a user