[FFmpeg-devel] [PATCH] libavformat/whip: Add av_freep() to avoid potential memory leak
Nicolas George
george at nsup.org
Fri Aug 8 14:07:02 EEST 2025
Jiasheng Jiang (HE12025-08-08):
> I found that after the success of avio_alloc_context(), buffer is
> assigned to rtp_ctx->pb->buffer and will be freed in whip_deinit().
> Therefore, I think moving av_freep() after end would cause a double
> free.
Indeed, you are right, I had not checked that.
With your change, if somebody adds an extra operation that might fail
between allocating the buffer and using it in the avio context. It might
be better to free the buffer at the end and set it to NULL if
avio_alloc_context() succeeds to avoid the double free, but that is very
minor.
So no objection to the patch, just take half a second considering my
suggestion.
Regards,
--
Nicolas George
More information about the ffmpeg-devel
mailing list