From c31bbcf4cfa7ecea97a79283b8c1ae590df2870f Mon Sep 17 00:00:00 2001 From: Jon Allie Date: Wed, 27 Nov 2019 06:28:07 -0500 Subject: [PATCH] builder/amazon: AmiFilterOptions.GetOwners: avoid taking the address of a loop iterator var (#8417) GetOwners() always returned a slice of pointers to the last value. Because slice ranging reuses the same local variable. --- builder/amazon/common/run_config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/amazon/common/run_config.go b/builder/amazon/common/run_config.go index 228ad52f6..07449a444 100644 --- a/builder/amazon/common/run_config.go +++ b/builder/amazon/common/run_config.go @@ -27,7 +27,8 @@ type AmiFilterOptions struct { func (d *AmiFilterOptions) GetOwners() []*string { res := make([]*string, 0, len(d.Owners)) for _, owner := range d.Owners { - res = append(res, &owner) + i := owner + res = append(res, &i) } return res }