On Tue, May 17, 2011 at 10:10:15AM -0400, Mike Williams wrote:
> Added fixes and tweaks suggested by Maksym Veremeyenko [[email protected]]
> 
> Signed-off-by: Mike Williams <[email protected]>
> ---
>  ffmpeg.c   |    5 ++---
>  ffserver.c |   18 +++++++-----------
>  2 files changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index c99c4de..8905fe8 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -626,13 +626,12 @@ static int read_ffserver_streams(AVFormatContext *s, 
> const char *filename)
>      if (err < 0)
>          return err;
>      /* copy stream format */
> -    s->nb_streams = 0;
> +    s->nb_streams = ic->nb_streams;
> +    s->streams = av_mallocz(sizeof(AVStream *) * s->nb_streams);
>      for(i=0;i<ic->nb_streams;i++) {
>          AVStream *st;
>          AVCodec *codec;
>  
> -        s->nb_streams++;
> -
>          // FIXME: a more elegant solution is needed
>          st = av_mallocz(sizeof(AVStream));
>          memcpy(st, ic->streams[i], sizeof(AVStream));

How is this chunk related to the ffserver crash? Also, you preallocate all
the streams but you still keep a per-stream allocation, there is something
wrong imho.

BTW, I'm tracking a crash in that scope of the code, I'm suspecting
something wrong in that place anyway.

About the rest of the patch, I confirm it fixes the ffserver crash in my
case.

Note: maybe sizeof *v insteand of sizeof type would be more appropriated?

-- 
Clément B.

Attachment: pgp8cwb9Q3XuL.pgp
Description: PGP signature

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to