Message ID | 1516270549-6972-1-git-send-email-redmcg@redmandi.dyndns.org |
---|---|
State | Superseded |
Headers | show |
On Thu, Jan 18, 2018 at 09:15:49PM +1100, Brendan McGrath wrote: > 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@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); > + } The if() is unneeded [...]
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;
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@redmandi.dyndns.org> --- libavformat/dashdec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)