From 2d8221c9d983d8625cd556aa88ea6302143b326f Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 9 Feb 2009 20:39:54 +0000 Subject: [PATCH] Fix one more case of an explicit null check before calling a free function that does the null check. Also, use krb5_free_keyblock_contents instead of open-coding all the work (and not trying hard enough to clear the memory). ticket: 6377 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21926 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/kfree.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/krb5/krb/kfree.c b/src/lib/krb5/krb/kfree.c index 2ddc0fa0f..c7c1c602c 100644 --- a/src/lib/krb5/krb/kfree.c +++ b/src/lib/krb5/krb/kfree.c @@ -60,8 +60,7 @@ krb5_free_address(krb5_context context, krb5_address *val) { if (val == NULL) return; - if (val->contents) - free(val->contents); + free(val->contents); free(val); } @@ -188,11 +187,7 @@ krb5_free_cred_contents(krb5_context context, krb5_creds *val) val->client = 0; krb5_free_principal(context, val->server); val->server = 0; - if (val->keyblock.contents) { - memset(val->keyblock.contents, 0, val->keyblock.length); - free(val->keyblock.contents); - val->keyblock.contents = 0; - } + krb5_free_keyblock_contents(context, &val->keyblock); free(val->ticket.data); val->ticket.data = 0; free(val->second_ticket.data); -- 2.26.2