Juniper / go-netconf

NETCONF implementation in Go.
Other
253 stars 110 forks source link

panic: when trying to close session where *TransportSSH is nil #98

Closed aniketgawade closed 3 years ago

aniketgawade commented 4 years ago
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x13e22b6]

goroutine 1788 [running]:
github.com/Juniper/go-netconf/netconf.(*TransportSSH).Close(0x0, 0xc000eb1360, 0xc000e3d2b0)
    external/com_github_juniper_go_netconf/netconf/transport_ssh.go:42 +0x26
github.com/Juniper/go-netconf/netconf.DialSSHTimeout(0xc0025fec80, 0x12, 0xc000e3d2b0, 0x2540be400, 0xc000e3d2b0, 0x20, 0x203000)
    external/com_github_juniper_go_netconf/netconf/transport_ssh.go:139 +0x110
....

If connToTransport return err the TransportSSH is nil and next, it tries to close nil session https://github.com/Juniper/go-netconf/blob/master/netconf/transport_ssh.go#L137

aniketgawade commented 3 years ago

fix merged