Huw Davies (@huw) commented about dlls/gdi32/text.c:
goto cleanup; } run_glyphs = new_run_glyphs;
new_psva = HeapReAlloc(GetProcessHeap(), 0, psva, sizeof(*psva) * cMaxGlyphs * 2);
if (!new_psva)
{
WARN("Out of memory\n");
HeapFree(GetProcessHeap(), 0, runOrder);
HeapFree(GetProcessHeap(), 0, visOrder);
HeapFree(GetProcessHeap(), 0, *lpGlyphs);
*lpGlyphs = NULL;
goto cleanup;
}
psva = new_psva;
Rather than adding lots more code, how about performing both `HeapReAlloc()`s first and then testing for either failing in the same `if` statement? In the failure case you'd need to add `HeapFree()`s for both `new_` ptrs, but it should be rather simpler.