[vlc-devel] [vlc-commits] hds: check for strdup failure

Rémi Denis-Courmont remi at remlab.net
Sat Jul 19 08:33:36 CEST 2014


Le samedi 19 juillet 2014, 04:07:39 Tristan Matthews a écrit :
> vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Fri Jul
> 18 21:54:24 2014 -0400| [160401294cbaa95b87bf0199c64590fef6b7fbc7] |
> committer: Tristan Matthews
> 
> hds: check for strdup failure
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=160401294cbaa95b87b
> > f0199c64590fef6b7fbc7
> ---
> 
>  modules/stream_filter/hds/hds.c |   31 +++++++++++++++++++------------
>  1 file changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/modules/stream_filter/hds/hds.c
> b/modules/stream_filter/hds/hds.c index 5402cbb..90b9992 100644
> --- a/modules/stream_filter/hds/hds.c
> +++ b/modules/stream_filter/hds/hds.c
> @@ -1009,6 +1009,10 @@ static void maintain_live_chunks(
>      hds_stream->chunks_head = chunk;
>  }
> 
> +#define SAFE_STRDUP( dest, src, ret )   \
> +    if( !( (dest) = strdup( (src) ) ) ) \
> +        return (ret)

Flaw controlling macros are horrible IMHO. And most probably this one leaks or 
will leak later when the code changes, since there is no way to perform any 
contextual clean-up.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list