Re: Expat and Open Watcom

Michael Greene <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Karl Waclawek wrote:
> Michael Greene wrote:
>> Karl,
>>
>> The source of my "out of memory" errors when running XML_TEST_SUITE 
>> are due to the test file size and using readfilemap.c. The test suite 
>> files are size 0, so malloc( 0 ) returns NULL and I get a false "out 
>> of memory" error. I assume that any build that uses readfilemap.c 
>> would have this return. Would it be better to do this:
>>
>>    nbytes = sb.st_size;
>> +  if(nbytes == 0) {
>> +    close(fd);
>> +    return 1;
>> +  }
>>    p = malloc(nbytes);
>>    if (!p) {
>> +    close(fd);
>>      return 0;
>>    }
>>
>> So that nbytes is checked for 0 size and return 1 ?
>>
>> With this change and a couple other defines I am at:
>>
>> Passed: 1773
>> Failed: 37
>>
>>
> 
> That sounds pretty good!
> 
> Would you please file a bug report for readfilemap.c?
> I'll then commit your patch.
> 
> Thanks,
> 
> Karl
> 

Submitted #1513566 - sorry about the WATCOM define include.

MikeG
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.