mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Fix memory leak of opus file structure
We were not calling `op_free` for `OggOpusFile *` after decoding opus files.
This commit is contained in:
parent
cfb5b15222
commit
d0e27fdcd4
|
@ -350,6 +350,7 @@ bool CSound::DecodeOpus(CSample &Sample, const void *pData, unsigned DataSize) c
|
|||
|
||||
if(NumChannels > 2)
|
||||
{
|
||||
op_free(pOpusFile);
|
||||
dbg_msg("sound/opus", "file is not mono or stereo.");
|
||||
return false;
|
||||
}
|
||||
|
@ -363,6 +364,7 @@ bool CSound::DecodeOpus(CSample &Sample, const void *pData, unsigned DataSize) c
|
|||
if(Read < 0)
|
||||
{
|
||||
free(pSampleData);
|
||||
op_free(pOpusFile);
|
||||
dbg_msg("sound/opus", "op_read error %d at %d", Read, Pos);
|
||||
return false;
|
||||
}
|
||||
|
@ -371,6 +373,8 @@ bool CSound::DecodeOpus(CSample &Sample, const void *pData, unsigned DataSize) c
|
|||
Pos += Read;
|
||||
}
|
||||
|
||||
op_free(pOpusFile);
|
||||
|
||||
Sample.m_pData = pSampleData;
|
||||
Sample.m_NumFrames = Pos;
|
||||
Sample.m_Rate = 48000;
|
||||
|
|
Loading…
Reference in a new issue