Skip to content

Commit

Permalink
Fix memory leak in write_tree
Browse files Browse the repository at this point in the history
  • Loading branch information
rapperskull committed Mar 5, 2023
1 parent d15cf13 commit 64a781b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extract-xiso.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ int decode_xiso( char *in_xiso, char *in_path, modes in_mode, char **out_iso_pat

if ( short_name ) free( short_name );
if ( cwd ) {
chdir( cwd );
if (chdir(cwd) == -1) chdir_err(cwd);
free( cwd );
}

Expand Down Expand Up @@ -1698,13 +1698,13 @@ int write_tree( dir_node_avl *in_avl, write_tree_context *in_context, int in_dep
if ( ! err && in_context->from == -1 ) {
if ( chdir( ".." ) == -1 ) chdir_err( ".." );
}

if ( context.path ) free( context.path );
} else {
memset(sector, XISO_PAD_BYTE, XISO_SECTOR_SIZE);
if ((pos = lseek(in_context->xiso, in_avl->start_sector * XISO_SECTOR_SIZE, SEEK_SET)) == -1) seek_err();
if (!err && write(in_context->xiso, sector, XISO_SECTOR_SIZE) != XISO_SECTOR_SIZE) write_err();
}

if (context.path) free(context.path);
}
}

Expand Down

0 comments on commit 64a781b

Please sign in to comment.