Skip to content

Commit

Permalink
- fixes missing memory stream dispose
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
  • Loading branch information
baywet committed Feb 20, 2023
1 parent 622a6e2 commit ce18649
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ public async Task<ReadResult> ReadAsync(Stream input, CancellationToken cancella
bufferedStream.Position = 0;
}

var reader = new StreamReader(bufferedStream);

return await new OpenApiTextReaderReader(_settings).ReadAsync(reader, cancellationToken);
using (var reader = new StreamReader(bufferedStream))
{
return await new OpenApiTextReaderReader(_settings).ReadAsync(reader, cancellationToken);
}
}

/// <summary>
Expand Down

0 comments on commit ce18649

Please sign in to comment.