Pull request: dnsforward: fix closing of uninitialized ipset ctx
Merge in DNS/adguard-home from fix-close to master Squashed commit of the following: commit 43b55105cc669e2740ef178808c81a22c8f53cc1 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Feb 1 19:19:12 2021 +0300 dnsforward: fix closing of uninitialized ipset ctx
This commit is contained in:
parent
3e0238aa99
commit
8fdd021ed7
|
@ -192,15 +192,19 @@ func (c *ipsetCtx) init(ipsetConfig []string) (err error) {
|
||||||
// Close closes the Linux Netfilter connections.
|
// Close closes the Linux Netfilter connections.
|
||||||
func (c *ipsetCtx) Close() (err error) {
|
func (c *ipsetCtx) Close() (err error) {
|
||||||
var errors []error
|
var errors []error
|
||||||
|
if c.ipv4Conn != nil {
|
||||||
err = c.ipv4Conn.Close()
|
err = c.ipv4Conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if c.ipv6Conn != nil {
|
||||||
err = c.ipv6Conn.Close()
|
err = c.ipv6Conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(errors) != 0 {
|
if len(errors) != 0 {
|
||||||
return agherr.Many("closing ipsets", errors...)
|
return agherr.Many("closing ipsets", errors...)
|
||||||
|
|
Loading…
Reference in New Issue