James Hawkins : setupapi: Fix SetupCloseInfFile when a NULL handle is
given , with tests.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jun 27 04:53:29 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: bce44161f1f836fbe53a6c2be6ca16478810f0d5
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=bce44161f1f836fbe53a6c2be6ca16478810f0d5
Author: James Hawkins <truiken at gmail.com>
Date: Mon Jun 26 14:46:04 2006 -0700
setupapi: Fix SetupCloseInfFile when a NULL handle is given, with tests.
---
dlls/setupapi/parser.c | 2 ++
dlls/setupapi/tests/parser.c | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c
index df30c6a..6b2c5d9 100644
--- a/dlls/setupapi/parser.c
+++ b/dlls/setupapi/parser.c
@@ -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 );
diff --git a/dlls/setupapi/tests/parser.c b/dlls/setupapi/tests/parser.c
index acdef8a..da49904 100644
--- a/dlls/setupapi/tests/parser.c
+++ b/dlls/setupapi/tests/parser.c
@@ -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 );
}
More information about the wine-cvs
mailing list