Commit 42c15f1c authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

urlmon: Use the _recalloc function instead of reimplementing it.

parent 078c6e5a
...@@ -1548,6 +1548,7 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2* ...@@ -1548,6 +1548,7 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2*
ZoneMgrImpl* This = impl_from_IInternetZoneManagerEx2(iface); ZoneMgrImpl* This = impl_from_IInternetZoneManagerEx2(iface);
LPDWORD * new_maps; LPDWORD * new_maps;
LPDWORD data; LPDWORD data;
DWORD new_map_count;
DWORD i; DWORD i;
TRACE("(%p)->(%p, %p, 0x%08lx)\n", This, pdwEnum, pdwCount, dwFlags); TRACE("(%p)->(%p, %p, 0x%08lx)\n", This, pdwEnum, pdwCount, dwFlags);
...@@ -1569,25 +1570,15 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2* ...@@ -1569,25 +1570,15 @@ static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManagerEx2*
} }
} }
if (This->zonemaps) { /* try to double the number of pointers in the array */
/* try to double the nr. of pointers in the array */ new_map_count = This->zonemaps ? This->zonemap_count * 2 : 2;
new_maps = realloc(This->zonemaps, This->zonemap_count * 2 * sizeof(DWORD*)); new_maps = _recalloc(This->zonemaps, new_map_count, sizeof(DWORD*));
if (new_maps) {
memset(new_maps + This->zonemap_count, 0, This->zonemap_count * sizeof(DWORD*));
This->zonemap_count *= 2;
}
}
else
{
This->zonemap_count = 2;
new_maps = calloc(This->zonemap_count, sizeof(DWORD*));
}
if (!new_maps) { if (!new_maps) {
free(data); free(data);
return E_FAIL; return E_FAIL;
} }
This->zonemaps = new_maps; This->zonemaps = new_maps;
This->zonemap_count = new_map_count;
This->zonemaps[i] = data; This->zonemaps[i] = data;
*pdwEnum = i; *pdwEnum = i;
*pdwCount = data[0]; *pdwCount = data[0];
......
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