Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy and paste error in lock()? #10

Open
orestisfl opened this issue Jun 24, 2024 · 0 comments
Open

Copy and paste error in lock()? #10

orestisfl opened this issue Jun 24, 2024 · 0 comments

Comments

@orestisfl
Copy link

k8slock/locker.go

Lines 187 to 192 in 6f294b1

lease.Spec.HolderIdentity = pointer.String(l.clientID)
if lease.Spec.LeaseTransitions != nil {
lease.Spec.LeaseTransitions = pointer.Int32((*lease.Spec.LeaseTransitions) + 1)
} else {
lease.Spec.LeaseTransitions = pointer.Int32((*lease.Spec.LeaseTransitions) + 1)
}

Here, the code checks if lease.Spec.LeaseTransitions is nil but the if-else branches are identical.

pointer.Int32((*lease.Spec.LeaseTransitions) + 1)

will segfault with a nil lease.Spec.LeaseTransitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant