diff options
author | Vladimir Kobal <vlad@prokk.net> | 2020-07-02 13:23:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-02 13:23:40 +0300 |
commit | 0b749a7dbeaddd588147ff3f2152c6fee528c311 (patch) | |
tree | 64ba00fceeddb44a46ad46976b533222b5e370f8 /collectors/cgroups.plugin | |
parent | 24bd7a3485eea6214bfda426f539b5f26b21e886 (diff) |
Fix a coverity defect (#9462)
Diffstat (limited to 'collectors/cgroups.plugin')
-rw-r--r-- | collectors/cgroups.plugin/sys_fs_cgroup.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 013e7e4f2b..007669456e 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -184,6 +184,7 @@ static enum cgroups_type cgroups_try_detect_version() if (!fgets(buf, MAXSIZE_PROC_CMDLINE, f)) { error("couldn't read all cmdline params into buffer"); + fclose(f); return CGROUPS_AUTODETECT_FAIL; } @@ -213,7 +214,7 @@ void read_cgroup_plugin_configuration() { cgroup_check_for_new_every = cgroup_update_every; cgroup_use_unified_cgroups = config_get_boolean_ondemand("plugin:cgroups", "use unified cgroups", CONFIG_BOOLEAN_AUTO); - if(cgroup_use_unified_cgroups == CONFIG_BOOLEAN_AUTO) + if(cgroup_use_unified_cgroups == CONFIG_BOOLEAN_AUTO) cgroup_use_unified_cgroups = (cgroups_try_detect_version() == CGROUPS_V2); info("use unified cgroups %s", cgroup_use_unified_cgroups ? "true" : "false"); |