Skip to content
Permalink
Browse files

handle nil pointer in ec2 discovery (#4469)

This handles a nil pointer that was being accessed in EC2 discovery.

Fixes: #4441

Signed-off-by: noqcks <benny@noqcks.io>
  • Loading branch information...
noqcks authored and brian-brazil committed Aug 7, 2018
1 parent 8bb6e0d commit 46fb4078a6bbf98732a9c9016a0104829b33ed99
Showing with 3 additions and 0 deletions.
  1. +3 −0 discovery/ec2/ec2.go
@@ -263,6 +263,9 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
var subnets []string
subnetsMap := make(map[string]struct{})
for _, eni := range inst.NetworkInterfaces {
if eni.SubnetId == nil {
continue
}
if _, ok := subnetsMap[*eni.SubnetId]; !ok {
subnetsMap[*eni.SubnetId] = struct{}{}
subnets = append(subnets, *eni.SubnetId)

0 comments on commit 46fb407

Please sign in to comment.
You can’t perform that action at this time.