valbok / QtAVPlayer

Free and open-source Qt Media Player library based on FFmpeg, for Linux, Windows, macOS, iOS and Android.
MIT License
282 stars 54 forks source link

Memory leak #477

Closed xdcsystems closed 3 months ago

xdcsystems commented 3 months ago

Hello,

QAVSubtitleFrame::QAVSubtitleFrame() : QAVStreamFrame(new QAVSubtitleFramePrivate) { Q_D(QAVSubtitleFrame); d->subtitle.reset(new AVSubtitle, subtitle_free); memset(d->subtitle.data(), 0, sizeof(d->subtitle.data())); }

Asan tell me - new AVSubtitle - not free

Propousal:

static void subtitle_free(AVSubtitle *subtitle) { avsubtitle_free(subtitle); delete subtitle; }

Leak very fast, ~8Gb around 2 minutes

Thanks

valbok commented 3 months ago

thanks,

looks delete subtitle; is missing, right.

Could you please add MR and will be merged you as author? Also did you try ASAN with that fix?

valbok commented 3 months ago

https://github.com/valbok/QtAVPlayer/pull/479

xdcsystems commented 3 months ago

thanks,

looks delete subtitle; is missing, right.

Could you please add MR and will be merged you as author? Also did you try ASAN with that fix?

Hi!

Sorry for the long time answer - a lot of work and little time :) I do not claim authorship, thank you for making the merge yourself. You have a good project, I wanted to help.

Yes, after this correction the asan says that everything is fine. Well, at least not bad ).

There are still leaks, but they are minor and, in my opinion, not worth attention. At least for now.

Thank you for your work and project. I was glad to help.