setupapi: Avoid crash in SetupCloseInfFile.
This commit is contained in:
parent
9dedfd71e0
commit
8be4e8537c
|
@ -1231,7 +1231,7 @@ void WINAPI SetupCloseInfFile( HINF hinf )
|
|||
struct inf_file *file = hinf;
|
||||
unsigned int i;
|
||||
|
||||
if (!file) return;
|
||||
if (!hinf || (hinf == INVALID_HANDLE_VALUE)) return;
|
||||
|
||||
for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] );
|
||||
HeapFree( GetProcessHeap(), 0, file->filename );
|
||||
|
|
|
@ -405,6 +405,11 @@ static void test_close_inf_file(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
SetupCloseInfFile(NULL);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
SetupCloseInfFile(INVALID_HANDLE_VALUE);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", GetLastError());
|
||||
|
||||
}
|
||||
|
||||
static const char *contents = "[Version]\n"
|
||||
|
|
Loading…
Reference in New Issue