[Expat-discuss] Expat and Open Watcom

Michael Greene greenemk at cox.com
Tue Jun 27 22:21:29 CEST 2006


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




More information about the Expat-discuss mailing list