diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-02-25 17:06:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-02-25 17:06:09 +0000 |
commit | cb8c7a125e4341ddaebd9d0ff00b6be0d87bab07 (patch) | |
tree | 92b46170e68b9545e89ad2f9c31a3adf3afe86dc /usr.bin/dig | |
parent | d2d30b3a196719e2d49d2e801ec5c4d4858b4e89 (diff) |
use freezero() rather that explicit_bzero() when free() is immediately
after.
pointed out by jsing
Diffstat (limited to 'usr.bin/dig')
-rw-r--r-- | usr.bin/dig/lib/dns/dst_api.c | 5 | ||||
-rw-r--r-- | usr.bin/dig/lib/dns/hmac_link.c | 17 |
2 files changed, 8 insertions, 14 deletions
diff --git a/usr.bin/dig/lib/dns/dst_api.c b/usr.bin/dig/lib/dns/dst_api.c index b415581b172..be9154041d0 100644 --- a/usr.bin/dig/lib/dns/dst_api.c +++ b/usr.bin/dig/lib/dns/dst_api.c @@ -33,7 +33,7 @@ /* * Principal Author: Brian Wellington - * $Id: dst_api.c,v 1.13 2020/02/25 16:54:24 deraadt Exp $ + * $Id: dst_api.c,v 1.14 2020/02/25 17:06:08 deraadt Exp $ */ /*! \file */ @@ -273,8 +273,7 @@ dst_key_free(dst_key_t **keyp) { isc_refcount_destroy(&key->refs); key->func->destroy(key); - explicit_bzero(key, sizeof(*key)); - free(key); + freezero(key, sizeof(*key)); *keyp = NULL; } diff --git a/usr.bin/dig/lib/dns/hmac_link.c b/usr.bin/dig/lib/dns/hmac_link.c index e704f92108c..76ef776957a 100644 --- a/usr.bin/dig/lib/dns/hmac_link.c +++ b/usr.bin/dig/lib/dns/hmac_link.c @@ -33,7 +33,7 @@ /* * Principal Author: Brian Wellington - * $Id: hmac_link.c,v 1.7 2020/02/25 16:54:24 deraadt Exp $ + * $Id: hmac_link.c,v 1.8 2020/02/25 17:06:08 deraadt Exp $ */ #include <string.h> @@ -117,8 +117,7 @@ static void hmacsha1_destroy(dst_key_t *key) { dst_hmacsha1_key_t *hkey = key->keydata.hmacsha1; - explicit_bzero(hkey, sizeof(*hkey)); - free(hkey); + freezero(hkey, sizeof(*hkey)); key->keydata.hmacsha1 = NULL; } @@ -262,8 +261,7 @@ static void hmacsha224_destroy(dst_key_t *key) { dst_hmacsha224_key_t *hkey = key->keydata.hmacsha224; - explicit_bzero(hkey, sizeof(*hkey)); - free(hkey); + freezero(hkey, sizeof(*hkey)); key->keydata.hmacsha224 = NULL; } @@ -407,8 +405,7 @@ static void hmacsha256_destroy(dst_key_t *key) { dst_hmacsha256_key_t *hkey = key->keydata.hmacsha256; - explicit_bzero(hkey, sizeof(*hkey)); - free(hkey); + freezero(hkey, sizeof(*hkey)); key->keydata.hmacsha256 = NULL; } @@ -552,8 +549,7 @@ static void hmacsha384_destroy(dst_key_t *key) { dst_hmacsha384_key_t *hkey = key->keydata.hmacsha384; - explicit_bzero(hkey, sizeof(*hkey)); - free(hkey); + freezero(hkey, sizeof(*hkey)); key->keydata.hmacsha384 = NULL; } @@ -697,8 +693,7 @@ static void hmacsha512_destroy(dst_key_t *key) { dst_hmacsha512_key_t *hkey = key->keydata.hmacsha512; - explicit_bzero(hkey, sizeof(*hkey)); - free(hkey); + freezero(hkey, sizeof(*hkey)); key->keydata.hmacsha512 = NULL; } |