fix: added socket closing to prevent resource leak
Detected by static analyzer that socket is not closed after use,
which can lead to resource leak and potential vulnerabilities such as
file descriptor exhaustion or denial of service (DoS) attacks.
Changes:
- Added `socket.Close()` call after finishing work with socket.
- Ensured that socket is closed even in case of errors while writing data.
This fix improves stability and security of code.
dbus is a simple library that implements native Go client bindings for the D-Bus message bus system.
This packages requires Go 1.20 or later. It can be installed by running the command below:
go get github.com/godbus/dbus/v5
The complete package documentation and some simple examples are available at pkg.go.dev. Also, the _examples directory gives a short overview over the basic usage.
Please note that the API is considered unstable for now and may change without further notice.
go.dbus is available under the Simplified BSD License; see LICENSE for the full text.
Nearly all of the credit for this library goes to github.com/guelfey/go.dbus.