diff --git a/command_test.go b/command_test.go
index 175f2ffd..165826d1 100644
--- a/command_test.go
+++ b/command_test.go
@@ -2926,7 +2926,8 @@ func TestHelpFuncExecuted(t *testing.T) {
 	helpText := "Long description"
 
 	// Create a context that will be unique, not just the background context
-	executionCtx, _ := context.WithCancel(context.Background())
+	executionCtx, cancel := context.WithCancel(context.Background())
+	defer cancel()
 
 	child := &Command{Use: "child", Run: emptyRun}
 	child.SetHelpFunc(func(cmd *Command, args []string) {