From 681690941143437b9008e6ac387d8f356f13baa2 Mon Sep 17 00:00:00 2001 From: Bharath Gajjala <120367134+bgajjala8@users.noreply.github.com> Date: Fri, 27 Jun 2025 23:31:37 -0500 Subject: [PATCH] Closing file unconditionally (#5886) --- internal/cmd/commands/connect/postgres.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/cmd/commands/connect/postgres.go b/internal/cmd/commands/connect/postgres.go index 69e15e97b1..43027bb344 100644 --- a/internal/cmd/commands/connect/postgres.go +++ b/internal/cmd/commands/connect/postgres.go @@ -98,6 +98,7 @@ func (p *postgresFlags) buildArgs(c *Command, port, ip, _ string, creds proxy.Cr }) _, err = passfile.WriteString(fmt.Sprintf("*:*:*:*:%s", password)) if err != nil { + _ = passfile.Close() return nil, nil, proxy.Credentials{}, fmt.Errorf("Error writing password file to %s: %w", passfile.Name(), err) } if err := passfile.Close(); err != nil {