Skip to content

Commit ded1478

Browse files
authored
Fix null pointer return in net_udp (#355)
* fix crash seen in node_exporter Signed-off-by: Hubert Chen <[email protected]>
1 parent 8c052e3 commit ded1478

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

net_udp.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,13 @@ func (fs FS) NetUDP6() (NetUDP, error) {
3838
// NetUDPSummary returns already computed statistics like the total queue lengths
3939
// for UDP datagrams read from /proc/net/udp.
4040
func (fs FS) NetUDPSummary() (*NetUDPSummary, error) {
41-
n, err := newNetUDPSummary(fs.proc.Path("net/udp"))
42-
n1 := NetUDPSummary(*n)
43-
return &n1, err
41+
return newNetUDPSummary(fs.proc.Path("net/udp"))
4442
}
4543

4644
// NetUDP6Summary returns already computed statistics like the total queue lengths
4745
// for UDP datagrams read from /proc/net/udp6.
4846
func (fs FS) NetUDP6Summary() (*NetUDPSummary, error) {
49-
n, err := newNetUDPSummary(fs.proc.Path("net/udp6"))
50-
n1 := NetUDPSummary(*n)
51-
return &n1, err
47+
return newNetUDPSummary(fs.proc.Path("net/udp6"))
5248
}
5349

5450
// newNetUDP creates a new NetUDP{,6} from the contents of the given file.

0 commit comments

Comments
 (0)