From 76684eaa3313822be5ed67425adc7c24cd38d644 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 11 May 2023 19:45:07 -0700 Subject: [PATCH] fix memory leak in StreamingSoundQoa.Create --- src/Audio/StreamingSoundQoa.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Audio/StreamingSoundQoa.cs b/src/Audio/StreamingSoundQoa.cs index eb2dd6f..5be9904 100644 --- a/src/Audio/StreamingSoundQoa.cs +++ b/src/Audio/StreamingSoundQoa.cs @@ -26,7 +26,7 @@ namespace MoonWorks.Audio FAudio.qoa_attributes(handle, out var channels, out var samplerate, out var samplesPerChannelPerFrame, out var totalSamplesPerChannel); - return new StreamingSoundQoa( + var streamingSound = new StreamingSoundQoa( device, filePath, channels, @@ -34,6 +34,10 @@ namespace MoonWorks.Audio samplesPerChannelPerFrame, totalSamplesPerChannel ); + + FAudio.qoa_close(handle); + + return streamingSound; } internal unsafe StreamingSoundQoa(