Skip to content

Commit aef5282

Browse files
committed
Fix memory leak in write_tree
1 parent 6ad26d1 commit aef5282

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

extract-xiso.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,7 @@ int decode_xiso( char *in_xiso, char *in_path, modes in_mode, char **out_iso_pat
11891189

11901190
if ( short_name ) free( short_name );
11911191
if ( cwd ) {
1192-
chdir( cwd );
1192+
if (chdir(cwd) == -1) chdir_err(cwd);
11931193
free( cwd );
11941194
}
11951195

@@ -1702,13 +1702,13 @@ int write_tree( dir_node_avl *in_avl, write_tree_context *in_context, int in_dep
17021702
if ( ! err && in_context->from == -1 ) {
17031703
if ( chdir( ".." ) == -1 ) chdir_err( ".." );
17041704
}
1705-
1706-
if ( context.path ) free( context.path );
17071705
} else {
17081706
memset(sector, XISO_PAD_BYTE, XISO_SECTOR_SIZE);
17091707
if ((pos = lseek(in_context->xiso, in_avl->start_sector * XISO_SECTOR_SIZE, SEEK_SET)) == -1) seek_err();
17101708
if (!err && write(in_context->xiso, sector, XISO_SECTOR_SIZE) != XISO_SECTOR_SIZE) write_err();
17111709
}
1710+
1711+
if (context.path) free(context.path);
17121712
}
17131713
}
17141714

0 commit comments

Comments
 (0)