[FFmpeg-devel] [PATCH] ffserver: Fix memory leak and uncheked av_strdup return

Ganesh Ajjanagadde gajjanag at mit.edu
Sun Nov 22 17:59:06 CET 2015


On Sun, Nov 22, 2015 at 11:16 AM, Derek Buitenhuis
<derek.buitenhuis at gmail.com> wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  ffserver.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/ffserver.c b/ffserver.c
> index 7e4f620..64a4a7a 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -3490,9 +3490,13 @@ static int add_av_stream(FFServerStream *feed, AVStream *st)
>      fst = add_av_stream1(feed, av, 0);
>      if (!fst)
>          return -1;
> -    if (av_stream_get_recommended_encoder_configuration(st))
> -        av_stream_set_recommended_encoder_configuration(fst,
> -            av_strdup(av_stream_get_recommended_encoder_configuration(st)));
> +    if (av_stream_get_recommended_encoder_configuration(st)) {
> +        char *tmp = av_strdup(av_stream_get_recommended_encoder_configuration(st));
> +        if (!tmp)
> +            return -1;
> +        av_stream_set_recommended_encoder_configuration(fst, tmp);
> +        av_free(tmp);
> +    }
>      return feed->nb_streams - 1;
>  }
>
> --
> 2.6.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

quick comment: typo in commit message "uncheked" -> "unchecked".


More information about the ffmpeg-devel mailing list