- Fix installation of INF sections including a section of the same name in another INF file

- Remove some tests to NULL before HeapFree calls

svn path=/trunk/; revision=21888
This commit is contained in:
Hervé Poussineau 2006-05-11 16:56:00 +00:00
parent 834787aacd
commit 919b2cb62d
2 changed files with 9 additions and 14 deletions

View file

@ -1719,8 +1719,7 @@ SETUP_CreateInterfaceList(
rc = ERROR_GEN_FAILURE; rc = ERROR_GEN_FAILURE;
goto cleanup; goto cleanup;
} }
if (InstancePath != NULL) HeapFree(GetProcessHeap(), 0, InstancePath);
HeapFree(GetProcessHeap(), 0, InstancePath);
InstancePath = HeapAlloc(GetProcessHeap(), 0, dwInstancePathLength + sizeof(WCHAR)); InstancePath = HeapAlloc(GetProcessHeap(), 0, dwInstancePathLength + sizeof(WCHAR));
if (!InstancePath) if (!InstancePath)
{ {
@ -1821,8 +1820,7 @@ SETUP_CreateInterfaceList(
InsertTailList(&list->ListHead, &deviceInfo->ListEntry); InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
/* Step 2. Create an interface list for this element */ /* Step 2. Create an interface list for this element */
if (pSymbolicLink != NULL) HeapFree(GetProcessHeap(), 0, pSymbolicLink);
HeapFree(GetProcessHeap(), 0, pSymbolicLink);
pSymbolicLink = HeapAlloc(GetProcessHeap(), 0, (dwLength + 1) * sizeof(WCHAR)); pSymbolicLink = HeapAlloc(GetProcessHeap(), 0, (dwLength + 1) * sizeof(WCHAR));
if (!pSymbolicLink) if (!pSymbolicLink)
{ {
@ -1875,10 +1873,8 @@ cleanup:
RegCloseKey(hDeviceInstanceKey); RegCloseKey(hDeviceInstanceKey);
if (hInterfaceKey != INVALID_HANDLE_VALUE) if (hInterfaceKey != INVALID_HANDLE_VALUE)
RegCloseKey(hInterfaceKey); RegCloseKey(hInterfaceKey);
if (InstancePath != NULL) HeapFree(GetProcessHeap(), 0, InstancePath);
HeapFree(GetProcessHeap(), 0, InstancePath); HeapFree(GetProcessHeap(), 0, pSymbolicLink);
if (pSymbolicLink != NULL)
HeapFree(GetProcessHeap(), 0, pSymbolicLink);
return rc; return rc;
} }
@ -3480,8 +3476,7 @@ cleanup:
RegCloseKey(hClassesKey); RegCloseKey(hClassesKey);
if (lpGuidString) if (lpGuidString)
RpcStringFreeW(&lpGuidString); RpcStringFreeW(&lpGuidString);
if (lpFullGuidString) HeapFree(GetProcessHeap(), 0, lpFullGuidString);
HeapFree(GetProcessHeap(), 0, lpFullGuidString);
return ret; return ret;
} }
@ -4098,12 +4093,12 @@ SetupDiCallClassInstaller(
while (!IsListEmpty(&ClassCoInstallersListHead)) while (!IsListEmpty(&ClassCoInstallersListHead))
{ {
ListEntry = RemoveHeadList(&ClassCoInstallersListHead); ListEntry = RemoveHeadList(&ClassCoInstallersListHead);
HeapFree(GetProcessHeap(), 0, ListEntry); HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
} }
while (!IsListEmpty(&DeviceCoInstallersListHead)) while (!IsListEmpty(&DeviceCoInstallersListHead))
{ {
ListEntry = RemoveHeadList(&DeviceCoInstallersListHead); ListEntry = RemoveHeadList(&DeviceCoInstallersListHead);
HeapFree(GetProcessHeap(), 0, ListEntry); HeapFree(GetProcessHeap(), 0, CONTAINING_RECORD(ListEntry, struct CoInstallerElement, ListEntry));
} }
ret = (rc == NO_ERROR); ret = (rc == NO_ERROR);

View file

@ -825,11 +825,11 @@ static BOOL needs_callback( HINF hinf, PCWSTR field, void *arg )
switch (info->type) switch (info->type)
{ {
case 0: case 0:
return SetupInstallFromInfSectionW(info->owner, hinf, field, info->flags, return SetupInstallFromInfSectionW(info->owner, *(HINF*)hinf, field, info->flags,
info->key_root, info->src_root, info->copy_flags, info->callback, info->key_root, info->src_root, info->copy_flags, info->callback,
info->context, info->devinfo, info->devinfo_data); info->context, info->devinfo, info->devinfo_data);
case 1: case 1:
return SetupInstallServicesFromInfSectionExW(hinf, field, info->flags, return SetupInstallServicesFromInfSectionExW(*(HINF*)hinf, field, info->flags,
info->devinfo, info->devinfo_data, info->reserved1, info->reserved2); info->devinfo, info->devinfo_data, info->reserved1, info->reserved2);
default: default:
ERR("Unknown info type %ld\n", info->type); ERR("Unknown info type %ld\n", info->type);