diff options
author | Vladimir Kobal <vlad@prokk.net> | 2019-10-07 14:33:31 +0300 |
---|---|---|
committer | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-10-07 13:33:31 +0200 |
commit | 1ad7e905d3401cced05b464091145361aa1ec25a (patch) | |
tree | d05bc8e2690ac7d13fd8d7dd9ade8d14f99f70ed /collectors/proc.plugin | |
parent | 8a9a071730935821ead45d23c8ad82f3f5a94ce0 (diff) |
Fix resource leak (#7007)
Diffstat (limited to 'collectors/proc.plugin')
-rw-r--r-- | collectors/proc.plugin/sys_block_zram.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/collectors/proc.plugin/sys_block_zram.c b/collectors/proc.plugin/sys_block_zram.c index a68a405def..170c72062d 100644 --- a/collectors/proc.plugin/sys_block_zram.c +++ b/collectors/proc.plugin/sys_block_zram.c @@ -181,10 +181,14 @@ static inline int read_mm_stat(procfile *ff, MM_STAT *stats) { ff = procfile_readall(ff); if (!ff) return -1; - if (procfile_lines(ff) < 1) + if (procfile_lines(ff) < 1) { + procfile_close(ff); return -1; - if (procfile_linewords(ff, 0) < 7) + } + if (procfile_linewords(ff, 0) < 7) { + procfile_close(ff); return -1; + } stats->orig_data_size = str2ull(procfile_word(ff, 0)); stats->compr_data_size = str2ull(procfile_word(ff, 1)); |