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:
Sebastian Reichel
2015-08-07 02:03:06 +02:00
parent cbd52d1a48
commit edad9bb7f5
8 changed files with 12 additions and 11 deletions

View File

@@ -319,7 +319,7 @@ static gchar* power_human_readable(struct psy_battery *bat) {
}
}
const char* linux_batteries_get_tooltip() {
char* linux_batteries_get_tooltip() {
GList *l;
GString *tooltip = g_string_new("");
gchar *result;