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
This commit is contained in:
parent
4fd08f4b8b
commit
5051755e35
@ -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…
Reference in New Issue
Block a user