Bugfix: valgrind memory issues (#314)

master
Julian Kunkel 2021-01-19 21:23:30 +00:00 committed by GitHub
parent fa316d5d24
commit 3daf7a2d0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include "md-workbench.h"
#include "config.h"
@ -343,7 +344,8 @@ static int compare_floats(time_result_t * x, time_result_t * y){
}
static double runtime_quantile(int repeats, time_result_t * times, float quantile){
int pos = round(quantile * repeats + 0.49);
int pos = round(quantile * (repeats - 1) + 0.49);
assert(pos < repeats);
return times[pos].runtime;
}

View File

@ -668,6 +668,7 @@ void mdtest_read(int random, int dirs, const long dir_iter, char *path) {
if (alloc_res) {
FAIL("out of memory");
}
memset(read_buffer, -1, o.read_bytes);
}
uint64_t stop_items = o.items;