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:
@@ -91,7 +91,8 @@ typedef struct {
|
||||
// after pos/size changed, the rendering engine will call _on_change_layout(Area*)
|
||||
int on_changed;
|
||||
void (*_on_change_layout)(void *obj);
|
||||
const char* (*_get_tooltip_text)(void *obj);
|
||||
// returns allocated string, that must be free'd after usage
|
||||
char* (*_get_tooltip_text)(void *obj);
|
||||
} Area;
|
||||
|
||||
// on startup, initialize fixed pos/size
|
||||
|
||||
Reference in New Issue
Block a user