Commit 58c3b5c1 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

devenum: Call DMOGetTypes() until less types are returned than were allocated.

parent 78d2a091
...@@ -147,28 +147,27 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, ...@@ -147,28 +147,27 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface,
}; };
unsigned int count = 1, input_count, output_count, i; unsigned int count = 1, input_count, output_count, i;
DMO_PARTIAL_MEDIATYPE *types = NULL; DMO_PARTIAL_MEDIATYPE *types = NULL, *new_array;
REGPINTYPES *reg_types; REGPINTYPES *reg_types;
HRESULT hr; HRESULT hr;
if (!(types = malloc(2 * count * sizeof(*types)))) do
return E_OUTOFMEMORY;
while ((hr = DMOGetTypes(&moniker->clsid, count, &input_count, types,
count, &output_count, types + count)) == S_FALSE)
{ {
count *= 2; count *= 2;
if (!(types = realloc(types, count * sizeof(*types)))) if (!(new_array = realloc(types, 2 * count * sizeof(*types))))
{ {
free(types); free(types);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
} types = new_array;
if (hr != S_OK)
{ if (FAILED(hr = DMOGetTypes(&moniker->clsid, count, &input_count, types,
free(types); count, &output_count, types + count)))
return hr; {
} free(types);
return hr;
}
} while (input_count == count || output_count == count);
if (!(reg_types = malloc(2 * count * sizeof(*reg_types)))) if (!(reg_types = malloc(2 * count * sizeof(*reg_types))))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment