demux: constify a struct member

Fixes a segfault when an invalid demuxer is given due to
uninitialized use of `filename` after goto.
This commit is contained in:
sfan5 committed 2023-02-24 13:22:03 +01:00
1 parent 84f6d7a97e
commit 3e85df3b2d
1 file changed
+2 -3
+2 -3
View File
@@ -3263,7 +3263,7 @@ struct parent_stream_info {
bool is_streaming;
int stream_origin;
struct mp_cancel *cancel;
char *filename;
const char *filename;
};
static struct demuxer *open_given_type(struct mpv_global *global,
@@ -3433,7 +3433,7 @@ static struct demuxer *demux_open(struct stream *stream,
.is_streaming = stream->streaming,
.stream_origin = stream->stream_origin,
.cancel = cancel,
.filename = talloc_strdup(NULL, stream->url),
.filename = stream->url,
};
// Test demuxers from first to last, one pass for each check_levels[] entry
@@ -3455,7 +3455,6 @@ static struct demuxer *demux_open(struct stream *stream,
}
done:
talloc_free(sinfo.filename);
talloc_free(log);
return demuxer;
}