Fix db_bench memory use after free (detected by clang_analyze)

Summary: Fix using `arg[i].thread` after deleting it

Test Plan: run clang_analyze

Subscribers: andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D63171
main
Islam AbdelRahman 8 years ago
parent 4fd08f4b8b
commit 5051755e35
  1. 10
      tools/db_bench_tool.cc

@ -2460,11 +2460,6 @@ class Benchmark {
}
shared.mu.Unlock();
for (int i = 0; i < n; i++) {
delete arg[i].thread;
}
delete[] arg;
// Stats for some threads can be excluded.
Stats merge_stats;
for (int i = 0; i < n; i++) {
@ -2472,6 +2467,11 @@ class Benchmark {
}
merge_stats.Report(name);
for (int i = 0; i < n; i++) {
delete arg[i].thread;
}
delete[] arg;
return merge_stats;
}

Loading…
Cancel
Save