prometheus / procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Apache License 2.0
756 stars 311 forks source link

static analyzer issue fix [closed] #512

Closed artemseleznev closed 1 year ago

artemseleznev commented 1 year ago

issue was found by Svace (https://www.ispras.ru/en/technologies/svace/)

discordianfish commented 1 year ago

Looks like this is a valid issue but using defer like this will keep all files open until the function returns. I'd either move this to a function that is called per file and uses defer or just wrap it in a anonymous function.

SuperQ commented 1 year ago

Yea, refactoring the reading to a function would be a good idea.