mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
optimize:fix resource leak Fixes #20
This commit is contained in:
parent
81cff1f4d5
commit
5c58bc7a54
10
dictzip.c
10
dictzip.c
|
@ -349,11 +349,13 @@ static enum DZ_ERRORS dict_read_header( const char *filename,
|
||||||
}
|
}
|
||||||
header->chunks = xmalloc( sizeof( header->chunks[0] )
|
header->chunks = xmalloc( sizeof( header->chunks[0] )
|
||||||
* header->chunkCount );
|
* header->chunkCount );
|
||||||
if( header->chunks == 0 ) {
|
if( header->chunks == 0 )
|
||||||
return DZ_ERR_NOMEMORY;
|
{
|
||||||
}
|
fclose( str );
|
||||||
|
return DZ_ERR_NOMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < header->chunkCount; i++) {
|
for (i = 0; i < header->chunkCount; i++) {
|
||||||
header->chunks[i] = getc( str ) << 0;
|
header->chunks[i] = getc( str ) << 0;
|
||||||
header->chunks[i] |= getc( str ) << 8;
|
header->chunks[i] |= getc( str ) << 8;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue