Skip to content

Commit

Permalink
dispose streams
Browse files Browse the repository at this point in the history
  • Loading branch information
standeren committed Dec 27, 2024
1 parent 24ef2fc commit d6690b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public async Task<IActionResult> UpsertProcessDefinitionAndNotify(string org, st

string developer = AuthenticationHelper.GetDeveloperUserName(HttpContext);
var editingContext = AltinnRepoEditingContext.FromOrgRepoDeveloper(org, repo, developer);

await using Stream stream = content.OpenReadStream();
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -815,17 +815,13 @@ public Stream GetProcessDefinitionFile()

public Definitions GetDefinitions()
{
Stream processDefinitionStream = GetProcessDefinitionFile();

MemoryStream memoryStream = new MemoryStream();
using Stream processDefinitionStream = GetProcessDefinitionFile();
using MemoryStream memoryStream = new MemoryStream();
processDefinitionStream.CopyTo(memoryStream);

memoryStream.Position = 0;

XmlSerializer serializer = new(typeof(Definitions));
Definitions definitions = (Definitions)serializer.Deserialize(memoryStream);

processDefinitionStream.Close();

return definitions;
}
Expand Down

0 comments on commit d6690b7

Please sign in to comment.