Browse code

Merge pull request #2585 from scottp-dpaw/lbendpoint_fix

service_linux: Fix null dereference in findLBEndpointSandbox

Sebastiaan van Stijn authored on 2020/11/01 02:31:17
Showing 1 changed files
... ...
@@ -67,11 +67,12 @@ func (n *network) findLBEndpointSandbox() (*endpoint, *sandbox, error) {
67 67
 	if !ok {
68 68
 		return nil, nil, fmt.Errorf("Unable to get sandbox for %s(%s) in for %s", ep.Name(), ep.ID(), n.ID())
69 69
 	}
70
-	ep = sb.getEndpoint(ep.ID())
71
-	if ep == nil {
70
+	var sep *endpoint
71
+	sep = sb.getEndpoint(ep.ID())
72
+	if sep == nil {
72 73
 		return nil, nil, fmt.Errorf("Load balancing endpoint %s(%s) removed from %s", ep.Name(), ep.ID(), n.ID())
73 74
 	}
74
-	return ep, sb, nil
75
+	return sep, sb, nil
75 76
 }
76 77
 
77 78
 // Searches the OS sandbox for the name of the endpoint interface