Zebediah Figura (@zfigura) commented about dlls/winegstreamer/wm_reader.c:
- reader->stream_count = wg_parser_get_stream_count(reader->wg_parser); - - if (!(reader->streams = calloc(reader->stream_count, sizeof(*reader->streams)))) + if (!reader->streams) { - hr = E_OUTOFMEMORY; - goto out_disconnect_parser; + reader->stream_count = wg_parser_get_stream_count(reader->wg_parser); + if (!(reader->streams = calloc(reader->stream_count, sizeof(*reader->streams)))) + { + hr = E_OUTOFMEMORY; + goto out_disconnect_parser; + } + for (i = 0; i < reader->stream_count; ++i) + reader->streams[i].selection = WMT_ON;
I don't like this pattern; in cases like this we should instead just split up the init_stream() helper to the part that's done on initialization and the part that's done on recreation. That said I would imagine more of this should be done on initialization...? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4449#note_54466