@cryptotaxi247 / netdata-1 / commits / 1ad7e905d

Fix resource leak (#7007)

Vladimir Kobal committed Oct 7, 2019 at 14:33 UTC 1ad7e905d3401cced05b464091145361aa1ec25a
1 file changed +6 -2
collectors/proc.plugin/sys_block_zram.c
+6 -2
@@ -181,10 +181,14 @@ static inline int read_mm_stat(procfile *ff, MM_STAT *stats) {
181 ff = procfile_readall(ff);
182 if (!ff)
183 return -1;
184 - if (procfile_lines(ff) < 1)
184 + if (procfile_lines(ff) < 1) {
185 + procfile_close(ff);
186 return -1;
186 - if (procfile_linewords(ff, 0) < 7)
187 + }
188 + if (procfile_linewords(ff, 0) < 7) {
189 + procfile_close(ff);
190 return -1;
191 + }
192
193 stats->orig_data_size = str2ull(procfile_word(ff, 0));
194 stats->compr_data_size = str2ull(procfile_word(ff, 1));