[FFmpeg-cvslog] dashdec: Only free url string if being reused
Brendan McGrath
git at videolan.org
Sun Jan 21 07:59:22 EET 2018
ffmpeg | branch: master | Brendan McGrath <redmcg at redmandi.dyndns.org> | Sun Jan 21 13:20:02 2018 +0800| [1f48c5c0671bb4f39c9dc3ec44c727f1680547b3] | committer: Steven Liu
dashdec: Only free url string if being reused
If no representation bandwidth value is set, the url value returned
by get_content_url is corrupt (as it has been freed).
This change ensures the url string is not freed unless it is about
to be reused
Changes since v1:
1 removed the unneeded 'if' statement (as pointed out by Michael Niedermayer
2 added comment to make it clear why the av_free was required
Signed-off-by: Brendan McGrath <redmcg at redmandi.dyndns.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f48c5c0671bb4f39c9dc3ec44c727f1680547b3
---
libavformat/dashdec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index a080bf3584..7d960670b9 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -483,9 +483,10 @@ 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') {
+ // free any previously assigned url before reassigning
+ av_free(url);
url = av_strireplace(tmp_str, "$Bandwidth$", (const char*)rep_bandwidth_val);
if (!url) {
return NULL;
More information about the ffmpeg-cvslog
mailing list