[FFmpeg-devel] [PATCH 4/4] avformat/webmdashenc: fix uninitialized variable

Ronald S. Bultje rsbultje at gmail.com
Thu Aug 20 15:35:54 CEST 2015


Hi,

On Thu, Aug 20, 2015 at 4:29 AM, Ganesh Ajjanagadde <gajjanagadde at gmail.com>
wrote:

> Fixes -Wsometimes-uninitialized from
>
> http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1
>
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavformat/webmdashenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index 76ea423..ecce4d3 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -388,7 +388,7 @@ static int write_adaptation_set(AVFormatContext *s,
> int as_index)
>
>      for (i = 0; i < as->nb_streams; i++) {
>          char *representation_id = NULL;
> -        int ret;
> +        int ret = -1;
>          if (w->is_live) {
>              AVDictionaryEntry *filename =
>                  av_dict_get(s->streams[as->streams[i]]->metadata,
> FILENAME, NULL, 0);
> --
> 2.5.0


This only happens when filename is NULL. Returning -1 seems
counterintuitive then, we should probably return AVERROR(EINVAL) or
something analogous. We can also decrease the scope for that by simply
returning AVERROR(EINVAL) Directly if filename is NULL, rather than
(ab)using ret for that.

Ronald


More information about the ffmpeg-devel mailing list