From 90990763aa5895d00934ef0924b10ca7b39821eb Mon Sep 17 00:00:00 2001
From: Scott Percival <scottp@lastyard.com>
Date: Tue, 22 Sep 2020 14:56:03 +0800
Subject: [PATCH] service_linux: Fix null dereference in findLBEndpointSandbox

Signed-off-by: Scott Percival <scottp@lastyard.com>
(cherry picked from commit 2fe6352d2420502217c3249db8c03c0d52287069)
Signed-off-by: Ameya Gawde <agawde@mirantis.com>

---
 service_linux.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/service_linux.go libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9-b/service_linux.go
index 3ffa607..bb0074f 100644
--- libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/service_linux.go
+++ libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9-b/service_linux.go
@@ -67,11 +67,13 @@ func (n *network) findLBEndpointSandbox() (*endpoint, *sandbox, error) {
 	if !ok {
 		return nil, nil, fmt.Errorf("Unable to get sandbox for %s(%s) in for %s", ep.Name(), ep.ID(), n.ID())
 	}
-	ep = sb.getEndpoint(ep.ID())
-	if ep == nil {
+	var sep *endpoint
+	sep = sb.getEndpoint(ep.ID())
+	if sep == nil {
 		return nil, nil, fmt.Errorf("Load balancing endpoint %s(%s) removed from %s", ep.Name(), ep.ID(), n.ID())
 	}
-	return ep, sb, nil
+	return sep, sb, nil
+	
 }
 
 // Searches the OS sandbox for the name of the endpoint interface
-- 
2.9.3.windows.1

