Fix two very small bugs found by running this code in valgrind.

svn path=/trunk/; revision=33041
This commit is contained in:
Art Yerkes 2008-04-19 23:16:39 +00:00
parent 436e9bc3ec
commit 8a990e7dd6
2 changed files with 4 additions and 3 deletions

View file

@ -34,7 +34,8 @@ BOOLEAN IniOpenSection(PCSTR SectionName, ULONG* SectionId)
if (_stricmp(SectionName, Section->SectionName) == 0)
{
// We found it
*SectionId = (ULONG)Section;
if (SectionId)
*SectionId = (ULONG)Section;
DbgPrint((DPRINT_INIFILE, "IniOpenSection() Found it! SectionId = 0x%x\n", SectionId));
return TRUE;
}

View file

@ -232,9 +232,9 @@ ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG B
Buffer[Idx] = '\0';
// Get rid of newline & linefeed characters (if any)
if((Buffer[strlen(Buffer)-1] == '\n') || (Buffer[strlen(Buffer)-1] == '\r'))
if(strlen(Buffer) && ((Buffer[strlen(Buffer)-1] == '\n') || (Buffer[strlen(Buffer)-1] == '\r')))
Buffer[strlen(Buffer)-1] = '\0';
if((Buffer[strlen(Buffer)-1] == '\n') || (Buffer[strlen(Buffer)-1] == '\r'))
if(strlen(Buffer) && ((Buffer[strlen(Buffer)-1] == '\n') || (Buffer[strlen(Buffer)-1] == '\r')))
Buffer[strlen(Buffer)-1] = '\0';
// Send back new offset