diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-07 21:10:22 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-07 21:10:22 +0200 |
commit | 66b29488a7ed5909564ed03b3e89cd0d008df09e (patch) | |
tree | 2ef1558a3c54b37b59a775f4734cb467cac183cb /utils | |
parent | 428d4fd45100c5c9b799f2fb127775b8b2382ecc (diff) | |
download | eurephia-66b29488a7ed5909564ed03b3e89cd0d008df09e.tar.gz eurephia-66b29488a7ed5909564ed03b3e89cd0d008df09e.tar.xz eurephia-66b29488a7ed5909564ed03b3e89cd0d008df09e.zip |
Moved all malloc() operations over to a calloc wrapper, malloc_nullsafe()
This also improves debugging as well, if debug logging is enabled and log level is >= 40.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/benchmark.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/utils/benchmark.c b/utils/benchmark.c index 24f4511..fb1af80 100644 --- a/utils/benchmark.c +++ b/utils/benchmark.c @@ -64,9 +64,8 @@ void benchmark_hashing(int rounds) { strncat(pwdsalt, randstr, 62 - strlen(saltstr)); memset(&randstr, 0, 32); - buffer = (char *) malloc(1024); + buffer = (char *) malloc_nullsafe(NULL, 1024); assert( buffer != NULL ); - memset(buffer, 0, 1024); pwdhash = sha512_crypt_r("benchmarkpassword", pwdsalt, ROUNDS_MAX, buffer, 1024); @@ -101,8 +100,8 @@ int timeval_subtract (result, x, y) struct timeval *do_benchmark(int rounds) { struct timeval start, end, *timediff = NULL; - timediff = (struct timeval *) malloc(sizeof(struct timeval)+2); - memset(timediff, 0, sizeof(struct timeval)+2); + timediff = (struct timeval *) malloc_nullsafe(NULL, sizeof(struct timeval)+2); + assert( timediff != NULL ); gettimeofday(&start, NULL); benchmark_hashing(rounds); |