[FFmpeg-devel] [PATCHv2] dashdec: Only free url string if being reused
Liu Steven
lq at chinaffmpeg.org
Sun Jan 21 08:02:15 EET 2018
> 在 2018年1月20日,上午9:14,Brendan McGrath <redmcg at redmandi.dyndns.org> 写道:
>
> 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
>
> Signed-off-by: Brendan McGrath <redmcg at redmandi.dyndns.org>
> ---
> Changes since v1:
> - removed the unneeded 'if' statement (as pointed out by Michael Niedermayer
> - added comment to make it clear why the av_free was required
>
> libavformat/dashdec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 2492f1d..6380318 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -482,9 +482,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;
> --
> 2.7.4
>
pushed
Thanks
Steven
More information about the ffmpeg-devel
mailing list