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 2023-02-24 13:19:47 +01:00
parent 84f6d7a97e
commit 3e85df3b2d
1 changed files with 2 additions and 3 deletions

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;
}