Commit 8be4e853 authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

setupapi: Avoid crash in SetupCloseInfFile.

parent 9dedfd71
......@@ -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"
......
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