mirror of
https://github.com/versity/versitygw.git
synced 2026-08-17 12:46:23 +00:00
fix: azure close download body in CopyObject to prevent resource leak
When copying between two different Azure blobs, the source download stream body was only consumed by PutObject but never explicitly closed. If PutObject or any subsequent step returned an error, the underlying HTTP connection held by the Azure SDK was never released, leaking both the connection and any internal SDK retry goroutines attached to it. Added a deferred close on downloadResp.Body immediately after the successful DownloadStream call to ensure the body is always drained and released regardless of the outcome.
This commit is contained in:
@@ -1042,6 +1042,7 @@ func (az *Azure) CopyObject(ctx context.Context, input s3response.CopyObjectInpu
|
||||
if err != nil {
|
||||
return s3response.CopyObjectOutput{}, azureErrToS3Err(err)
|
||||
}
|
||||
defer downloadResp.Body.Close()
|
||||
|
||||
pInput := s3response.PutObjectInput{
|
||||
Body: downloadResp.Body,
|
||||
|
||||
Reference in New Issue
Block a user