From 221e144dc9e3927345844d7c6f9774b334068fa6 Mon Sep 17 00:00:00 2001 From: Danilo Almeida Date: Fri, 4 Feb 2000 23:55:21 +0000 Subject: [PATCH] * kinit.c: Only free stuff if it's not NULL. (Note: The krb5_free_* routines probably should be fixed check for NULL pointers...) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12000 dc483132-0cff-0310-8789-dd5450dbe970 --- src/clients/kinit/ChangeLog | 4 ++++ src/clients/kinit/kinit.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/clients/kinit/ChangeLog b/src/clients/kinit/ChangeLog index ca82dc719..b3f0ab0c3 100644 --- a/src/clients/kinit/ChangeLog +++ b/src/clients/kinit/ChangeLog @@ -1,3 +1,7 @@ +2000-02-04 Danilo Almeida + + * kinit.c: Only free stuff if it's not NULL. + 2000-02-04 Tom Yu * Makefile.in (kinit): Fix to build on Unix again. diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index df162ca51..509d30d02 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -826,7 +826,11 @@ int try_convert524(k5) if (!got_k4 || !got_k5) return 0; - increds.client = 0; + memset((char *) &increds, 0, sizeof(increds)); + /* + From this point on, we can goto cleanup because increds is + initialized. + */ /* or do this directly with krb524_convert_creds_kdc */ krb524_init_ets(k5->ctx); @@ -843,7 +847,6 @@ int try_convert524(k5) goto cleanup; } - memset((char *) &increds, 0, sizeof(increds)); increds.client = k5->me; increds.server = kpcserver; increds.times.endtime = 0; @@ -887,10 +890,12 @@ int try_convert524(k5) cleanup: memset(&v4creds, 0, sizeof(v4creds)); - krb5_free_creds(k5->ctx, v5creds); + if (v5creds) + krb5_free_creds(k5->ctx, v5creds); increds.client = 0; krb5_free_cred_contents(k5->ctx, &increds); - krb5_free_principal(k5->ctx, kpcserver); + if (kpcserver) + krb5_free_principal(k5->ctx, kpcserver); return !(code || icode); } #endif /* HAVE_KRB524 */ -- 2.26.2