Skip to content

Commit

Permalink
Fix dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Aug 3, 2023
1 parent 98a449b commit 2b5f1e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Minio/ApiEndpoints/ObjectOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task<SelectResponseStream> SelectObjectContentAsync(SelectObjectCon
using var response =
await ExecuteTaskAsync(NoErrorHandlers, requestMessageBuilder, cancellationToken: cancellationToken)
.ConfigureAwait(false);
using var selectObjectContentResponse =
var selectObjectContentResponse =
new SelectObjectContentResponse(response.StatusCode, response.Content, response.ContentBytes);
return selectObjectContentResponse.ResponseStream;
}
Expand Down
3 changes: 2 additions & 1 deletion Minio/DataModel/Response/SelectObjectContentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ internal SelectObjectContentResponse(HttpStatusCode statusCode, string responseC
ResponseStream = new SelectResponseStream(stream);
}

internal SelectResponseStream ResponseStream { get; }
internal SelectResponseStream ResponseStream { get; private set; }

public virtual void Dispose()
{
if (disposed) return;

ResponseStream?.Dispose();
ResponseStream = null;

disposed = true;
}
Expand Down
2 changes: 2 additions & 0 deletions Minio/DataModel/Select/SelectResponseStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public void Dispose()
payloadStream?.Dispose();
Payload?.Dispose();

Payload = null;

disposed = true;
}

Expand Down

0 comments on commit 2b5f1e6

Please sign in to comment.