[PATCH 02/10] mf: Do some error checkings in _Load().

Sergio Gómez Del Real sdelreal at codeweavers.com
Mon Jun 22 19:24:34 CDT 2020


On 22/06/20 6:37 a. m., Nikolay Sivov wrote:

>
> On 6/15/20 4:41 AM, Sergio Gómez Del Real wrote:
>> +    if (FAILED(IMFTopology_GetNodeCount(input_topology, &count))
>> +        || count < 2)
>> +    {
>> +        hr = MF_E_TOPO_UNSUPPORTED;
>> +        return hr;
>> +    }
> This should come up later as more generic case of zero branches, or
> badly incomplete output topology.
The reason I insist with this is that this case specifically returns 
MF_E_TOPO_UNSUPPORTED. Continuing with processing could return a 
different, mistaken, error.
>> +
>> +    if (FAILED(hr = MFCreateTopology(output_topology)))
>> +        return hr;
>> +
>> +    i = 0;
>> +    while (SUCCEEDED(IMFTopology_GetNode(input_topology, i++, &node)))
>>       {
> Won't moving creation call before the loop leak output topology on error
> case?
> I seems unlikely that on error condition it still returns empty output
> topology.
Right. There could be an error later on, if output node doesn't have 
IMFStreamSink interface, which would leak output_topology. I'll also add 
error checking for _CloneFrom().



More information about the wine-devel mailing list