mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
check for remaining memory being < 0, not just <=, since we allocate exactly as much as we need. Fixes failure due to being out of memory at same time as having finished parsing stdin.
This commit is contained in:
parent
de0c62fb39
commit
d43acd6b46
1 changed files with 5 additions and 5 deletions
|
@ -610,7 +610,7 @@ parseAndSort( FILE* infile )
|
|||
if ( eof ) {
|
||||
break;
|
||||
}
|
||||
if ( memleft <= 0 ) {
|
||||
if ( memleft < 0 ) {
|
||||
ERROR_EXIT( "no memory left\n" );
|
||||
}
|
||||
}
|
||||
|
@ -743,11 +743,11 @@ MakeTrieNode( int letter, bool isTerminal, int firstChildOffset,
|
|||
static void
|
||||
writeOutStartNode( const char* startNodeOut, int firstRootChildOffset )
|
||||
{
|
||||
FILE* NODEOUT;
|
||||
NODEOUT = fopen( startNodeOut, "w" );
|
||||
FILE* nodeout;
|
||||
nodeout = fopen( startNodeOut, "w" );
|
||||
unsigned long be = htonl( firstRootChildOffset );
|
||||
(void)fwrite( &be, sizeof(be), 1, NODEOUT );
|
||||
fclose( NODEOUT );
|
||||
(void)fwrite( &be, sizeof(be), 1, nodeout );
|
||||
fclose( nodeout );
|
||||
} // writeOutStartNode
|
||||
|
||||
// build the hash for translating. I'm using a hash assuming it'll be
|
||||
|
|
Loading…
Reference in a new issue