Browse Source

ffplay: set stream_index to -1 earlier to prevent segfault

Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit 6cfb33f976)
tags/n4.2.3
Peter Ross Marton Balint 5 years ago
parent
commit
1fc446d7e2
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      fftools/ffplay.c

+ 3
- 3
fftools/ffplay.c View File

@@ -2760,9 +2760,6 @@ static int read_thread(void *arg)
}

memset(st_index, -1, sizeof(st_index));
is->last_video_stream = is->video_stream = -1;
is->last_audio_stream = is->audio_stream = -1;
is->last_subtitle_stream = is->subtitle_stream = -1;
is->eof = 0;

ic = avformat_alloc_context();
@@ -3068,6 +3065,9 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
is = av_mallocz(sizeof(VideoState));
if (!is)
return NULL;
is->last_video_stream = is->video_stream = -1;
is->last_audio_stream = is->audio_stream = -1;
is->last_subtitle_stream = is->subtitle_stream = -1;
is->filename = av_strdup(filename);
if (!is->filename)
goto fail;


Loading…
Cancel
Save