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.
This commit is contained in:
Dudemanguy 2023-10-01 15:54:39 -05:00
parent d50de74c1e
commit 0a1e3d8685
1 changed files with 9 additions and 9 deletions

View File

@ -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];