From 59f809e9922ad2a8ed5373189e0e2aec0d4dffd7 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Mon, 21 Oct 2013 16:53:32 +0200 Subject: [PATCH 1/3] lavf/tee: fix leak of strdup/strtoked buffer. Fix CID 1108606. --- libavformat/tee.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index 40b59a4be9..171a827b46 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -102,10 +102,10 @@ fail: static int parse_bsfs(void *log_ctx, const char *bsfs_spec, AVBitStreamFilterContext **bsfs) { - char *bsf_name, *buf, *saveptr; + char *bsf_name, *buf, *dup, *saveptr; int ret = 0; - if (!(buf = av_strdup(bsfs_spec))) + if (!(dup = buf = av_strdup(bsfs_spec))) return AVERROR(ENOMEM); while (bsf_name = av_strtok(buf, ",", &saveptr)) { @@ -128,7 +128,7 @@ static int parse_bsfs(void *log_ctx, const char *bsfs_spec, } end: - av_free(buf); + av_free(dup); return ret; } From 5a12142aca228ca1000650793aeb50b3b32994b6 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Mon, 21 Oct 2013 17:00:56 +0200 Subject: [PATCH 2/3] lavf/tee: fix leak of select option. --- libavformat/tee.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/tee.c b/libavformat/tee.c index 171a827b46..78348e3d61 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -280,6 +280,7 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) end: av_free(format); + av_free(select); av_dict_free(&options); return ret; } From c4e6024adc18df8ff82157227e2b4159f77951f9 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Mon, 21 Oct 2013 17:02:17 +0200 Subject: [PATCH 3/3] lavf/tee: fix leak of bsfs array. --- libavformat/tee.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/tee.c b/libavformat/tee.c index 78348e3d61..12ea0ea27d 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -303,6 +303,7 @@ static void close_slaves(AVFormatContext *avf) } } av_freep(&tee->slaves[i].stream_map); + av_freep(&tee->slaves[i].bsfs); avio_close(avf2->pb); avf2->pb = NULL;