+2000-02-04 Danilo Almeida <dalmeida@mit.edu>
+
+ * kinit.c: Only free stuff if it's not NULL.
+
2000-02-04 Tom Yu <tlyu@mit.edu>
* Makefile.in (kinit): Fix to build on Unix again.
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);
goto cleanup;
}
- memset((char *) &increds, 0, sizeof(increds));
increds.client = k5->me;
increds.server = kpcserver;
increds.times.endtime = 0;
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 */