File tree 1 file changed +5
-6
lines changed
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -255,13 +255,11 @@ nonnull_all
255
255
void zone_close_file (
256
256
parser_t * parser , zone_file_t * file )
257
257
{
258
- assert (file -> name != not_a_file || !file -> handle );
259
- assert (file -> path != not_a_file || !file -> handle );
258
+ const bool is_string = file -> name == not_a_file || file -> path == not_a_file ;
260
259
261
- if (!file -> handle )
262
- return ;
260
+ assert (!is_string || !file -> handle );
263
261
264
- if (file -> buffer .data )
262
+ if (file -> buffer .data && ! is_string )
265
263
free (file -> buffer .data );
266
264
file -> buffer .data = NULL ;
267
265
if (file -> name && file -> name != not_a_file )
@@ -270,7 +268,8 @@ void zone_close_file(
270
268
if (file -> path && file -> name != not_a_file )
271
269
free ((char * )file -> path );
272
270
file -> path = NULL ;
273
- (void )fclose (file -> handle );
271
+ if (file -> handle )
272
+ (void )fclose (file -> handle );
274
273
file -> handle = NULL ;
275
274
if (file != & parser -> first )
276
275
free (file );
You can’t perform that action at this time.
0 commit comments