diff options
author | Dudemanguy <random342@airmail.cc> | 2023-10-01 15:54:39 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-01 16:11:53 -0500 |
commit | 0a1e3d86852bc6267a622b9ec442c4a3ea9d66d9 (patch) | |
tree | 4f67a4bc8f81873e910ddb0aa0cbb4ec10117915 | |
parent | d50de74c1ee79ada5d27b465a9074b0ebf87cedf (diff) | |
download | mpv-0a1e3d86852bc6267a622b9ec442c4a3ea9d66d9.tar.bz2 mpv-0a1e3d86852bc6267a622b9ec442c4a3ea9d66d9.tar.xz |
demux: move parent_stream_info before the goto
Previously if the demuxer didn't exist, then it could jump down and try
to free sinfo.filename before it was ever set thus segfaulting. Just
always set the struct unconditionally so we're always sure to free it.
-rw-r--r-- | demux/demux.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/demux/demux.c b/demux/demux.c index 2b1e670b28..d3da4a0fd1 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -3388,6 +3388,15 @@ static struct demuxer *demux_open(struct stream *stream, struct demuxer *demuxer = NULL; char *force_format = params ? params->force_format : NULL; + struct parent_stream_info sinfo = { + .seekable = stream->seekable, + .is_network = stream->is_network, + .is_streaming = stream->streaming, + .stream_origin = stream->stream_origin, + .cancel = cancel, + .filename = talloc_strdup(NULL, stream->url), + }; + if (!force_format) force_format = stream->demuxer; @@ -3409,15 +3418,6 @@ static struct demuxer *demux_open(struct stream *stream, } } - struct parent_stream_info sinfo = { - .seekable = stream->seekable, - .is_network = stream->is_network, - .is_streaming = stream->streaming, - .stream_origin = stream->stream_origin, - .cancel = cancel, - .filename = talloc_strdup(NULL, stream->url), - }; - // Test demuxers from first to last, one pass for each check_levels[] entry for (int pass = 0; check_levels[pass] != -1; pass++) { enum demux_check level = check_levels[pass]; |