[FFmpeg-devel] [PATCH v1 02/11] avformat/hlsenc: fix memleak of vtt_dirname_r in hls_delete_old_segments

Limin Wang lance.lmwang at gmail.com
Wed Oct 9 11:36:12 EEST 2019


On Wed, Oct 09, 2019 at 03:35:21PM +0800, Steven Liu wrote:
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
>  libavformat/hlsenc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index a1c03dbed5..a689acc2e0 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -575,6 +575,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls,
>          if ((segment->sub_filename[0] != '\0')) {
>              char *vtt_dirname_r = av_strdup(vs->vtt_avf->url);
>              vtt_dirname = (char*)av_dirname(vtt_dirname_r);
> +            av_freep(&vtt_dirname_r);

vtt_dirname use the memory still so you can't free it here, the current code try to free
by vtt_dirname, it's not correct. I have send  my changes to support system interface, you
can help to review the patchset.

>              sub_path_size = strlen(segment->sub_filename) + 1 + strlen(vtt_dirname);
>              sub_path = av_malloc(sub_path_size);
>              if (!sub_path) {
> -- 
> 2.15.1
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list