Skip to content

Commit d125096

Browse files
Fix resource leak: close staging Rows in execStagingOperation (#325)
## Summary - `execStagingOperation` creates a `Rows` object via `rows.NewRows()` to read staging operation metadata (presigned URL, headers, local file path) but never calls `row.Close()` - This leaks the `Rows` object and its `RowScanner` resources until GC collects them - Add `defer row.Close()` to ensure proper cleanup after reading the staging metadata Note: the server-side operation is already closed by `ExecContext` (lines 122-133), so this is a client-side resource leak rather than a server-side operation leak. ## Test plan - [x] Existing `TestConn_execStagingOperation` tests pass - [x] `TestWorkflowExample` e2e test passes - [x] `go build ./...` compiles cleanly Related: #275 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 98148d9 commit d125096

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

connection.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ func (c *conn) execStagingOperation(
592592
if err != nil {
593593
return dbsqlerrint.NewDriverError(ctx, "error reading row.", err)
594594
}
595+
defer row.Close()
595596

596597
} else {
597598
return dbsqlerrint.NewDriverError(ctx, "staging ctx must be provided.", nil)

0 commit comments

Comments
 (0)