Esme Povirk (@madewokherd) commented about dlls/comdlg32/itemdlg.c:
if (This->filterspecs[i].pszName != NULL && This->filterspecs[i].pszSpec != NULL)
{
DWORD name_len = lstrlenW(This->filterspecs[i].pszName);
if (name_len == 0 || This->filterspecs[i].pszName[name_len - 1] != L')')
{
DWORD spec_len = lstrlenW(This->filterspecs[i].pszSpec);
DWORD total_len = name_len + spec_len + 4;
WCHAR* pszName = HeapAlloc(GetProcessHeap(), 0, total_len * sizeof(WCHAR));
if (pszName != NULL)
{
swprintf(pszName, total_len, L"%s (%s)", This->filterspecs[i].pszName, This->filterspecs[i].pszSpec);
HeapFree(GetProcessHeap(), 0, (void*)This->filterspecs[i].pszName);
I don't think the cast on this line is necessary.