From 20339d3948ae87f50992f3e5fab1f6d7a5ad5875 Mon Sep 17 00:00:00 2001 From: Vikrant Puppala Date: Sun, 22 Feb 2026 08:39:21 +0000 Subject: [PATCH] Fix resource leak: close staging Rows in execStagingOperation execStagingOperation creates a Rows object via rows.NewRows() to read staging operation metadata but never closes it. This leaks the Rows object and its RowScanner resources until GC collects them. Add defer row.Close() to ensure proper cleanup. Related: #275 Co-Authored-By: Claude Opus 4.6 --- connection.go | 1 + 1 file changed, 1 insertion(+) diff --git a/connection.go b/connection.go index 08606dc..c297d5b 100644 --- a/connection.go +++ b/connection.go @@ -592,6 +592,7 @@ func (c *conn) execStagingOperation( if err != nil { return dbsqlerrint.NewDriverError(ctx, "error reading row.", err) } + defer row.Close() } else { return dbsqlerrint.NewDriverError(ctx, "staging ctx must be provided.", nil)