Commit 73927044 authored by Peter Wu's avatar Peter Wu Committed by Richard Hughes

daemon: fix memleak in org.freedesktop.UPower.Wakeups.GetData

up_wakeups_get_cmdline returns allocated memory and
up_wakeup_item_set_cmdline duplicates it. Therefore free the former
after setting it on the item.

https://bugs.freedesktop.org/show_bug.cgi?id=82659
parent d1971e4d
...@@ -469,6 +469,7 @@ up_wakeups_poll_userspace_cb (UpWakeups *wakeups) ...@@ -469,6 +469,7 @@ up_wakeups_poll_userspace_cb (UpWakeups *wakeups)
guint pid; guint pid;
guint interrupts; guint interrupts;
gfloat interval = 5.0f; gfloat interval = 5.0f;
gchar *cmdline;
g_debug ("event"); g_debug ("event");
...@@ -546,7 +547,9 @@ up_wakeups_poll_userspace_cb (UpWakeups *wakeups) ...@@ -546,7 +547,9 @@ up_wakeups_poll_userspace_cb (UpWakeups *wakeups)
up_wakeup_item_set_is_userspace (item, FALSE); up_wakeup_item_set_is_userspace (item, FALSE);
} else { } else {
/* try to get a better command line */ /* try to get a better command line */
up_wakeup_item_set_cmdline (item, up_wakeups_get_cmdline (pid)); cmdline = up_wakeups_get_cmdline (pid);
up_wakeup_item_set_cmdline (item, cmdline);
g_free (cmdline);
if (up_wakeup_item_get_cmdline (item) == NULL || if (up_wakeup_item_get_cmdline (item) == NULL ||
up_wakeup_item_get_cmdline (item)[0] == '\0') up_wakeup_item_get_cmdline (item)[0] == '\0')
up_wakeup_item_set_cmdline (item, string); up_wakeup_item_set_cmdline (item, string);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment