diff options
author | George Burgess IV <gbiv@google.com> | 2018-05-17 18:59:16 -0700 |
---|---|---|
committer | George Burgess IV <gbiv@google.com> | 2018-05-17 19:00:42 -0700 |
commit | d82fbe9fa6e7abb3dc1f06c210ce53ec48ca2f7b (patch) | |
tree | 8410c9e877d17704f9de301c1b75439d071c16e7 /ioshark | |
parent | 059211abcb154e94dd538ce51a198f41c7988ea5 (diff) | |
download | extras-d82fbe9fa6e7abb3dc1f06c210ce53ec48ca2f7b.tar.gz |
resolve merge conflicts of c6e4407afcf383e98ce543185e8d90b2b8e6fb97 to pi-dev-plus-aosp
I directly applied the patch that I made for master:
b4bc355453fe535a1839be80895c84ff6fb1eb7f
BUG: None
Test: mma
Change-Id: Ibd709b6ad150008dc65c9baa9d2e5bbd8ac9239e
Diffstat (limited to 'ioshark')
-rw-r--r-- | ioshark/ioshark_bench.c | 13 | ||||
-rw-r--r-- | ioshark/ioshark_bench_subr.c | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/ioshark/ioshark_bench.c b/ioshark/ioshark_bench.c index 80600425..e44a2a53 100644 --- a/ioshark/ioshark_bench.c +++ b/ioshark/ioshark_bench.c @@ -428,7 +428,7 @@ do_io(struct thread_state_s *state) if (ioshark_read_file_op(state->fp, &file_op) != 1) { fprintf(stderr, "%s read error trace.outfile\n", progname); - exit(EXIT_FAILURE); + goto fail; } if (do_delay) { struct timeval start; @@ -446,7 +446,7 @@ do_io(struct thread_state_s *state) fprintf(stderr, "%s state filename %s, i %d\n", progname, state->filename, i); - exit(EXIT_FAILURE); + goto fail; } if (file_op.ioshark_io_op != IOSHARK_OPEN && files_db_get_fd(db_node) == -1) { @@ -469,18 +469,25 @@ do_io(struct thread_state_s *state) files_db_get_filename(db_node), openflags, errno); - exit(EXIT_FAILURE); + goto fail; } files_db_update_fd(db_node, fd); } do_one_io(db_node, &file_op, op_counts, &rw_bytes, &buf, &buflen); } + + free(buf); files_db_fsync_discard_files(state->db_handle); files_db_close_files(state->db_handle); update_time(&aggregate_delay_time, &total_delay_time); update_op_counts(op_counts); update_byte_counts(&aggr_io_rw_bytes, &rw_bytes); + return; + +fail: + free(buf); + exit(EXIT_FAILURE); } void * diff --git a/ioshark/ioshark_bench_subr.c b/ioshark/ioshark_bench_subr.c index e7ca3f90..8bc702ee 100644 --- a/ioshark/ioshark_bench_subr.c +++ b/ioshark/ioshark_bench_subr.c @@ -289,11 +289,13 @@ create_file(char *path, size_t size, struct rw_bytes_s *rw_bytes) fprintf(stderr, "%s Cannot write file %s, error = %d\n", progname, path, errno); + free(buf); exit(EXIT_FAILURE); } rw_bytes->bytes_written += n; size -= n; } + free(buf); if (fsync(fd) < 0) { fprintf(stderr, "%s Cannot fsync file %s, error = %d\n", progname, path, errno); |