diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-07-15 14:56:21 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-07-15 14:56:21 +0900 |
commit | db9f7abb7af7b5c5bc2ec356c614a5cdb88d75a6 (patch) | |
tree | f47dd4742823c53c5092ac1eb1e79a7173e4d71a /src/hmac256.c | |
parent | b98ca3f798abd17696f52163665204c4e83d9092 (diff) | |
download | libgcrypt-db9f7abb7af7b5c5bc2ec356c614a5cdb88d75a6.tar.gz |
hmac: Use xfree.
* src/hmac256.c [STANDALONE] (xfree): Define.
(_gcry_hmac256_new, _gcry_hmac256_release): Use xfree.
(_gcry_hmac256_file): Likewise.
--
Fixes-commit: 3e3b520fb32a37c5c23762531a7b3168e112ac36
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'src/hmac256.c')
-rw-r--r-- | src/hmac256.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hmac256.c b/src/hmac256.c index 78dcf8af..6283cb18 100644 --- a/src/hmac256.c +++ b/src/hmac256.c @@ -70,6 +70,7 @@ typedef uint32_t u32; #ifdef STANDALONE #define xtrymalloc(a) malloc((a)) #define gpg_err_set_errno(a) (errno = (a)) +#define xfree(a) free((a)) #else #include "g10lib.h" #endif @@ -341,7 +342,7 @@ _gcry_hmac256_new (const void *key, size_t keylen) tmphd = _gcry_hmac256_new (NULL, 0); if (!tmphd) { - free (hd); + xfree (hd); return NULL; } _gcry_hmac256_update (tmphd, key, keylen); @@ -373,7 +374,7 @@ _gcry_hmac256_release (hmac256_context_t ctx) /* Note: We need to take care not to modify errno. */ if (ctx->use_hmac) my_wipememory (ctx->opad, 64); - free (ctx); + xfree (ctx); } } @@ -489,7 +490,7 @@ _gcry_hmac256_file (void *result, size_t resultsize, const char *filename, while ( (nread = fread (buffer, 1, buffer_size, fp))) _gcry_hmac256_update (hd, buffer, nread); - free (buffer); + xfree (buffer); if (ferror (fp)) { |