diff options
| author | David Sommerseth <dazo@users.sourceforge.net> | 2009-03-22 22:53:07 +0100 |
|---|---|---|
| committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-03-22 22:53:07 +0100 |
| commit | c30851586fc6c8de1a67202dc1c99de855e34f43 (patch) | |
| tree | 7027c844d55828cf02957d24a50593d57beb005a /utils | |
| parent | 51778987ec3cc565fa4eaaacdc28f98c02a23226 (diff) | |
| download | eurephia-c30851586fc6c8de1a67202dc1c99de855e34f43.tar.gz eurephia-c30851586fc6c8de1a67202dc1c99de855e34f43.tar.xz eurephia-c30851586fc6c8de1a67202dc1c99de855e34f43.zip | |
Fixed a memory leak in benchmark.c
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/benchmark.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/benchmark.c b/utils/benchmark.c index fe56c51..ce2b6bf 100644 --- a/utils/benchmark.c +++ b/utils/benchmark.c @@ -73,6 +73,8 @@ int benchmark(int *min, int *max, int thr_min, int thr_max) { struct timeval *time = NULL, min_time, max_time ; printf("Benchmarking "); + *min = 1000; + *max = 5000; for( i = 1000; i < 100000000; i += 1000 ) { printf("."); fflush(stdout); @@ -80,9 +82,10 @@ int benchmark(int *min, int *max, int thr_min, int thr_max) { // printf("%i rounds: %ld sec %ld ms\n", i, time->tv_sec, time->tv_usec); if( time->tv_usec > (thr_max * 1000) ) { success = 1; + free(time); break; } - if( (*min == 0) && (time->tv_usec > (thr_min * 1000)) ) { + if( (*min == 1000) && (time->tv_usec > (thr_min * 1000)) ) { *min = i; min_time.tv_usec = time->tv_usec; } |
