Commit bce44161 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

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

parent 251d7688
...@@ -1220,6 +1220,8 @@ void WINAPI SetupCloseInfFile( HINF hinf ) ...@@ -1220,6 +1220,8 @@ void WINAPI SetupCloseInfFile( HINF hinf )
struct inf_file *file = hinf; struct inf_file *file = hinf;
unsigned int i; unsigned int i;
if (!file) return;
for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] ); for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] );
HeapFree( GetProcessHeap(), 0, file->filename ); HeapFree( GetProcessHeap(), 0, file->filename );
HeapFree( GetProcessHeap(), 0, file->sections ); HeapFree( GetProcessHeap(), 0, file->sections );
......
...@@ -387,10 +387,18 @@ static void test_key_names(void) ...@@ -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) START_TEST(parser)
{ {
test_invalid_files(); test_invalid_files();
test_section_names(); test_section_names();
test_key_names(); test_key_names();
test_close_inf_file();
DeleteFileA( tmpfile ); DeleteFileA( tmpfile );
} }
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