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

netstat.go: File handler leak #539

Closed stasos24 closed 1 year ago

stasos24 commented 1 year ago

In case of successfull reading, fs handler is not closed.

https://github.com/prometheus/procfs/blob/45f8bbf7767e825c530bde78868438a9702fb7b3/netstat.go#L31-#L48

SuperQ commented 1 year ago

Can you provide more information? You linked to a whole function, which doesn't contain a leak.

The internal function parseNetstat() contains a defer file.Close(), so there is no leak.

stasos24 commented 1 year ago

Can you provide more information? You linked to a whole function, which doesn't contain a leak.

The internal function parseNetstat() contains a defer file.Close(), so there is no leak.

Sorry, looks like i mistook a version procfs@v0.9.0 Not relevant in last version