summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-11-17 22:32:42 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-11-18 10:30:40 +0100
commitbae214a8c8a56b3f520db209ffc9903a86810260 (patch)
treec1101693109cd4f160cd1a26080e2d74bc25121e
parent15154e1d9759dfeeb161b9339d9e25592129e9d6 (diff)
downloadupower-bae214a8c8a56b3f520db209ffc9903a86810260.tar.gz
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. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--src/up-wakeups.c5
1 files changed, 4 insertions, 1 deletions
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);