aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2020-04-25 11:25:15 +1000
committerPeter Ross <pross@xvid.org>2020-04-25 12:11:11 +1000
commit6cfb33f976812a52bceba29b3db3bbdb84ab7c32 (patch)
tree3f30c029bfa76fbbf8fc32ddfd19c57ffef0c24c
parent1217b06a9b5e8264fa86ab0e7573564c39bf3ce9 (diff)
downloadffmpeg-6cfb33f976812a52bceba29b3db3bbdb84ab7c32.tar.gz
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>
-rw-r--r--fftools/ffplay.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 1beec54293..d673b8049a 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2775,9 +2775,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();
@@ -3083,6 +3080,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;