[FFmpeg-devel] [PATCH] dashdec: Only free url string if being reused

Brendan McGrath redmcg at redmandi.dyndns.org
Thu Jan 18 12:15:49 EET 2018


If no representation bandwidth value is set, the url value returned
by get_content_url is corrupt (as the memory has been freed).

This change ensures the url string is not freed unless it is about
to be reused

Signed-off-by: Brendan McGrath <redmcg at redmandi.dyndns.org>
---
 libavformat/dashdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 2492f1d..83980b9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -482,9 +482,11 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes,
             return NULL;
         }
         av_strlcpy(tmp_str, url, sizeof(tmp_str));
-        av_free(url);
     }
     if (rep_bandwidth_val && tmp_str[0] != '\0') {
+        if (url) {
+            av_free(url);
+        }
         url = av_strireplace(tmp_str, "$Bandwidth$", (const char*)rep_bandwidth_val);
         if (!url) {
             return NULL;
-- 
2.7.4



More information about the ffmpeg-devel mailing list