syedhali / EZAudio

An iOS and macOS audio visualization framework built upon Core Audio useful for anyone doing real-time, low-latency audio processing and visualizations.
Other
4.94k stars 822 forks source link

freeHistoryInfo frees circularBuffer after freeing containing data structure (historyInfo)? #292

Open headcrash13 opened 8 years ago

headcrash13 commented 8 years ago

I have a bad data access happening somewhere (reusing EZAudioFile waveform data). However, while tracking that problem down, I am having another bad access happen while the TPCircularBuffer is being cleaned up, especially with "Malloc Scribble" enabled:

EZAudioUtilities : 710 + (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo

free(historyInfo->buffer);
free(historyInfo);
TPCircularBufferCleanup(&historyInfo->circularBuffer);

I believe this should be:

free(historyInfo->buffer);
TPCircularBufferCleanup(&historyInfo->circularBuffer);
free(historyInfo);
spotby commented 8 years ago

I am running into this too. Your suggestion fixed by bad access error. thanks!

ryanfrancesconi commented 8 years ago

Thank you - this has fixed my error as well.