From: H.G. Muller Date: Mon, 26 Oct 2009 06:21:07 +0000 (-0700) Subject: The book-probe code forgot to close the book file after opening it. X-Git-Tag: v4.4.1~24 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=75ee8e95af06463d34cc68cc2da70c63b61deb71 The book-probe code forgot to close the book file after opening it. fixed by adding an fclose at two points. --- diff --git a/book.c b/book.c index 2ec8546..ba7a9af 100644 --- a/book.c +++ b/book.c @@ -481,7 +481,10 @@ char *ProbeBook(int moveNr, char *book) if(appData.debugMode) fprintf(debugFP, "book key = %08x%08x\n", (unsigned int)(key>>32), (unsigned int)key); offset=find_key(f, key, &entry); - if(entry.key != key) return NULL; + if(entry.key != key) { + fclose(f); + return NULL; + } entries[0] = entry; count=1; fseek(f, 16*(offset+1), SEEK_SET); @@ -510,5 +513,6 @@ char *ProbeBook(int moveNr, char *book) move_to_string(move_s, entries[i].move); if(appData.debugMode) fprintf(debugFP, "book move field = %d\n", entries[i].move); + fclose(f); return move_s; }