Skip to content

Commit

Permalink
Merge branch 'td-eo-double-free-fix' of https://github.com/dpronin/fio
Browse files Browse the repository at this point in the history
* 'td-eo-double-free-fix' of https://github.com/dpronin/fio:
  correctly free thread_data options at the topmost parent process
  • Loading branch information
axboe committed Jul 28, 2023
2 parents f12affa + 913028e commit 696abd9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 0 additions & 4 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2494,10 +2494,7 @@ static void run_threads(struct sk_out *sk_out)
strerror(ret));
} else {
pid_t pid;
void *eo;
dprint(FD_PROCESS, "will fork\n");
eo = td->eo;
read_barrier();
pid = fork();
if (!pid) {
int ret;
Expand All @@ -2506,7 +2503,6 @@ static void run_threads(struct sk_out *sk_out)
_exit(ret);
} else if (__td_index == fio_debug_jobno)
*fio_debug_jobp = pid;
free(eo);
free(fd);
fd = NULL;
}
Expand Down
3 changes: 2 additions & 1 deletion ioengines.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ void free_ioengine(struct thread_data *td)
if (td->eo && td->io_ops->options) {
options_free(td->io_ops->options, td->eo);
free(td->eo);
td->eo = NULL;
if (td->o.use_thread)
td->eo = NULL;
}

if (td->io_ops->dlhandle) {
Expand Down
4 changes: 2 additions & 2 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -5829,9 +5829,9 @@ void fio_options_free(struct thread_data *td)
options_free(fio_options, &td->o);
if (td->eo && td->io_ops && td->io_ops->options) {
options_free(td->io_ops->options, td->eo);
free(td->eo);
td->eo = NULL;
}
free(td->eo);
td->eo = NULL;
}

void fio_dump_options_free(struct thread_data *td)
Expand Down

0 comments on commit 696abd9

Please sign in to comment.