Skip to content

Commit f054ff5

Browse files
committed
misc: fix hypothetical implicit memory aliasing
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
1 parent 6575eff commit f054ff5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/controller/helmrelease_controller.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -771,13 +771,13 @@ func (r *HelmReleaseReconciler) requestsForHelmChartChange(ctx context.Context,
771771
}
772772

773773
var reqs []reconcile.Request
774-
for _, hr := range list.Items {
774+
for i, hr := range list.Items {
775775
// If the HelmRelease is ready and the revision of the artifact equals to the
776776
// last attempted revision, we should not make a request for this HelmRelease
777-
if conditions.IsReady(&hr) && hc.GetArtifact().HasRevision(hr.Status.LastAttemptedRevision) {
777+
if conditions.IsReady(&list.Items[i]) && hc.GetArtifact().HasRevision(hr.Status.LastAttemptedRevision) {
778778
continue
779779
}
780-
reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&hr)})
780+
reqs = append(reqs, reconcile.Request{NamespacedName: client.ObjectKeyFromObject(&list.Items[i])})
781781
}
782782
return reqs
783783
}

internal/runner/post_renderer_kustomize.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ func (k *postRendererKustomize) Run(renderedManifests *bytes.Buffer) (modifiedMa
119119
}
120120

121121
// Add JSON 6902 patches.
122-
for _, m := range k.spec.PatchesJSON6902 {
122+
for i, m := range k.spec.PatchesJSON6902 {
123123
patch, err := json.Marshal(m.Patch)
124124
if err != nil {
125125
return nil, err
126126
}
127127
cfg.PatchesJson6902 = append(cfg.PatchesJson6902, kustypes.Patch{
128128
Patch: string(patch),
129-
Target: adaptSelector(&m.Target),
129+
Target: adaptSelector(&k.spec.PatchesJSON6902[i].Target),
130130
})
131131
}
132132

0 commit comments

Comments
 (0)