From 57bd4c578e337319d4a190311bb08ef98d0d7358 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 28 Aug 2013 15:19:48 +0200 Subject: [PATCH] cgroups plugin: Use cu_mount_checkoption(). cu_mount_checkoption() behaves a bit like strstr() in that it returns a pointer into the buffer. cu_mount_getoptionvalue() allocated memory that was never freed, slowly leaking memory (although very little). Github: #412 --- src/cgroups.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cgroups.c b/src/cgroups.c index ffb1740a..a515cf5b 100644 --- a/src/cgroups.c +++ b/src/cgroups.c @@ -217,8 +217,9 @@ static int cgroups_read (void) { /* Find the cgroup mountpoint which contains the cpuacct * controller. */ - if (strcmp(mnt_ptr->type, "cgroup") != 0 || - !cu_mount_getoptionvalue(mnt_ptr->options, "cpuacct")) + if ((strcmp(mnt_ptr->type, "cgroup") != 0) + || !cu_mount_checkoption(mnt_ptr->options, + "cpuacct", /* full = */ 1)) continue; walk_directory (mnt_ptr->dir, read_cpuacct_root, -- 2.30.2