From: Nikolay Sivov Subject: Re: [PATCH 02/10] mf: Do some error checkings in _Load(). Message-Id: <810c0a0d-5f81-11fa-11ef-a2a905cf2678@codeweavers.com> Date: Mon, 22 Jun 2020 14:37:36 +0300 In-Reply-To: <20200615014158.6836-2-sdelreal@codeweavers.com> References: <20200615014158.6836-1-sdelreal@codeweavers.com> <20200615014158.6836-2-sdelreal@codeweavers.com> 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. > + > + 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.