From: Florian Forster Date: Wed, 28 Aug 2013 13:19:48 +0000 (+0200) Subject: cgroups plugin: Use cu_mount_checkoption(). X-Git-Tag: collectd-5.4.1~19 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=57bd4c578e337319d4a190311bb08ef98d0d7358;p=collectd.git 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 --- 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,