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

Michael Niedermayer michael at niedermayer.cc
Fri Jan 19 20:40:31 EET 2018


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 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);
> +        }

The if() is unneeded

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180119/bb414d65/attachment.sig>


More information about the ffmpeg-devel mailing list