Closed r-lyeh-archived closed 8 years ago
Ty for fixing #13! :)
Yeah... sorry about the leak -- debugging detritus. I'll hold off on the merge because I have a ton of little cleanups to do. The temporary buffer was also just a quick debugging test :)
This is the original decoder plus the minimal fix I've been able to implement.
I saw the destructor was leaking
decoderMemory
so I was going to fix it. Then I saw your new code had that inefficent memcpy and I wanted to get rid of it, so I took some more time to figure out what was going on with the heap corruption.Now with your new code it was clear to me that the decoder needed some more extra padding space at the end (in fact, it is expecting to be at least MPC_DECODER_BUFFER_LENGTH/MPC_SAMPLE_FORMAT bytes) so I just reserved the vector properly, then resized it as it was meant to be (so the extra padding is left at the end for the decoder to overwrite).
Hope it is more clear now :)
TL;DR: the original source is kept, then only line at 125 was added
PS: It's ok if you dont want to merge this PR, but in that case dont forget to add
delete decoderMemory;
aftermpc_demux_init()
! :smile: