[PATCH 05/10] daemon: fix memleak in org.freedesktop.UPower.Wakeups.GetData
Peter Wu
peter at lekensteyn.nl
Wed Nov 26 03:21:12 PST 2014
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
---
src/up-wakeups.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/up-wakeups.c b/src/up-wakeups.c
index 38b8870..87e829e 100644
--- a/src/up-wakeups.c
+++ b/src/up-wakeups.c
@@ -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);
--
2.1.3
More information about the devkit-devel
mailing list