Skip to content

Commit

Permalink
[desktop-bg] Fix memory leak during background change events
Browse files Browse the repository at this point in the history
The string returned by eel_bg_get_desktop_color() needs to be freed by
the caller, which wasn't happening before.

Commit b9cf366 fixed the case where this function was being called
repeatedly, triggering this leak and causing it to rapidly fill system
memory.
  • Loading branch information
bitness authored and lukefromdc committed Jul 11, 2018
1 parent 2d179e4 commit 78d9182
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libcaja-private/caja-directory-background.c
Expand Up @@ -323,12 +323,15 @@ desktop_background_changed_cb (EelBackground *background,
static gboolean
desktop_background_prefs_change_event_idle_cb (EelBackground *background)
{
gchar *desktop_color = NULL;

eel_bg_load_from_gsettings (background,
mate_background_preferences);

eel_background_set_color (background,
eel_bg_get_desktop_color (background));
desktop_color = eel_bg_get_desktop_color (background);
eel_background_set_color (background, desktop_color);

g_free(desktop_color);
g_object_unref (background);

return FALSE; /* remove from the list of event sources */
Expand Down

0 comments on commit 78d9182

Please sign in to comment.