[Expat-discuss] Expat and Open Watcom
Karl Waclawek
karl at waclawek.net
Tue Jun 27 15:33:07 CEST 2006
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
More information about the Expat-discuss
mailing list