setupapi: Fix SetupCloseInfFile when a NULL handle is given, with tests.

This commit is contained in:
James Hawkins 2006-06-26 14:46:04 -07:00 committed by Alexandre Julliard
parent 251d76888d
commit bce44161f1
2 changed files with 10 additions and 0 deletions

View File

@ -1220,6 +1220,8 @@ void WINAPI SetupCloseInfFile( HINF hinf )
struct inf_file *file = hinf;
unsigned int i;
if (!file) return;
for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] );
HeapFree( GetProcessHeap(), 0, file->filename );
HeapFree( GetProcessHeap(), 0, file->sections );

View File

@ -387,10 +387,18 @@ static void test_key_names(void)
}
static void test_close_inf_file(void)
{
SetLastError(0xdeadbeef);
SetupCloseInfFile(NULL);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
}
START_TEST(parser)
{
test_invalid_files();
test_section_names();
test_key_names();
test_close_inf_file();
DeleteFileA( tmpfile );
}