From: Danilo Almeida Date: Fri, 4 Feb 2000 23:55:21 +0000 (+0000) Subject: * kinit.c: Only free stuff if it's not NULL. (Note: The krb5_free_* X-Git-Tag: krb5-1.2-beta1~119 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=221e144dc9e3927345844d7c6f9774b334068fa6;p=krb5.git * 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 --- 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 */