Skip to content

Commit

Permalink
fix: double release memory
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Aug 10, 2024
1 parent 36ec18a commit 1f02a39
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dictzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static enum DZ_ERRORS dict_read_header( const char * filename, dictData * header
fclose( str );
if ( header->chunks ) {
free( header->chunks );
header->chunks = 0;
header->chunks = NULL;
}
return DZ_ERR_INVALID_FORMAT;
}
Expand All @@ -397,7 +397,7 @@ static enum DZ_ERRORS dict_read_header( const char * filename, dictData * header
fclose( str );
if ( header->chunks ) {
free( header->chunks );
header->chunks = 0;
header->chunks = NULL;
}
return DZ_ERR_INVALID_FORMAT;
}
Expand All @@ -422,7 +422,7 @@ static enum DZ_ERRORS dict_read_header( const char * filename, dictData * header
fclose( str );
if ( header->chunks ) {
free( header->chunks );
header->chunks = 0;
header->chunks = NULL;
}
return DZ_ERR_INVALID_FORMAT;
}
Expand All @@ -443,7 +443,7 @@ static enum DZ_ERRORS dict_read_header( const char * filename, dictData * header
if ( header->offsets == 0 ) {
if ( header->chunks ) {
free( header->chunks );
header->chunks = 0;
header->chunks = NULL;
}
return DZ_ERR_NOMEMORY;
}
Expand Down

0 comments on commit 1f02a39

Please sign in to comment.