Don't leak memory in the speex resampler wrapper if something goes bad
This commit is contained in:
parent
871c16028a
commit
010fb01bf8
|
@ -400,8 +400,17 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
LibSpeexDSP.speex_resampler_destroy(st);
|
||||
st = IntPtr.Zero;
|
||||
if (st != IntPtr.Zero)
|
||||
{
|
||||
LibSpeexDSP.speex_resampler_destroy(st);
|
||||
st = IntPtr.Zero;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
~SpeexResampler()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
void InternalDrain(short[] buf, int nsamp)
|
||||
|
|
Loading…
Reference in New Issue