Author: hpoussin Date: Thu May 11 21:43:31 2006 New Revision: 21889
URL: http://svn.reactos.ru/svn/reactos?rev=21889&view=rev Log: Some more error checking...
Modified: trunk/reactos/dll/win32/setupapi/parser.c
Modified: trunk/reactos/dll/win32/setupapi/parser.c URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/win32/setupapi/parser.c?... ============================================================================== --- trunk/reactos/dll/win32/setupapi/parser.c (original) +++ trunk/reactos/dll/win32/setupapi/parser.c Thu May 11 21:43:31 2006 @@ -1302,12 +1302,15 @@ struct inf_file *file = hinf; unsigned int i;
- for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] ); - HeapFree( GetProcessHeap(), 0, file->filename ); - HeapFree( GetProcessHeap(), 0, file->sections ); - HeapFree( GetProcessHeap(), 0, file->fields ); - HeapFree( GetProcessHeap(), 0, file->strings ); - HeapFree( GetProcessHeap(), 0, file ); + if (file != NULL) + { + for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] ); + HeapFree( GetProcessHeap(), 0, file->filename ); + HeapFree( GetProcessHeap(), 0, file->sections ); + HeapFree( GetProcessHeap(), 0, file->fields ); + HeapFree( GetProcessHeap(), 0, file->strings ); + HeapFree( GetProcessHeap(), 0, file ); + } }
@@ -1339,6 +1342,9 @@ int section_index; LONG ret = -1;
+ if (hinf == NULL || hinf == INVALID_HANDLE_VALUE) + return ERROR_INVALID_PARAMETER; + for (file = hinf; file; file = file->next) { if ((section_index = find_section( file, section )) == -1) continue; @@ -1377,6 +1383,12 @@ { struct inf_file *file = hinf; int section_index; + + if (hinf == NULL || hinf == INVALID_HANDLE_VALUE) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + }
SetLastError( ERROR_SECTION_NOT_FOUND ); for (file = hinf; file; file = file->next) @@ -1437,6 +1449,12 @@ { struct inf_file *file; int section_index; + + if (hinf == NULL || hinf == INVALID_HANDLE_VALUE) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + }
SetLastError( ERROR_SECTION_NOT_FOUND ); for (file = hinf; file; file = file->next)