mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-04 10:38:17 +02:00
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
This commit is contained in:
parent
d1971e4d16
commit
73927044cb
1 changed files with 4 additions and 1 deletions
|
|
@ -469,6 +469,7 @@ up_wakeups_poll_userspace_cb (UpWakeups *wakeups)
|
|||
guint pid;
|
||||
guint interrupts;
|
||||
gfloat interval = 5.0f;
|
||||
gchar *cmdline;
|
||||
|
||||
g_debug ("event");
|
||||
|
||||
|
|
@ -546,7 +547,9 @@ up_wakeups_poll_userspace_cb (UpWakeups *wakeups)
|
|||
up_wakeup_item_set_is_userspace (item, FALSE);
|
||||
} else {
|
||||
/* 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 ||
|
||||
up_wakeup_item_get_cmdline (item)[0] == '\0')
|
||||
up_wakeup_item_set_cmdline (item, string);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue