Make sure the right structures actually get copied instead of aliased, and
authorTheodore Tso <tytso@mit.edu>
Tue, 18 Aug 1992 23:21:22 +0000 (23:21 +0000)
committerTheodore Tso <tytso@mit.edu>
Tue, 18 Aug 1992 23:21:22 +0000 (23:21 +0000)
make sure everything gets freed on an error return.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2330 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/sendauth.c

index 30bd54e708ae42162fcc870167fb1735c0fd36a5..cb3180495ea85cab4ec4502af58c4135fa91c0db 100644 (file)
@@ -119,9 +119,12 @@ krb5_sendauth(/* IN */
        if (!credsp) {
                if (!ccache)
                        return(KRB5_NOCREDS_SUPPLIED);
-               creds.server = (krb5_principal) server;
-               if (retval = krb5_copy_principal(client, &creds.client))
+               if (retval = krb5_copy_principal(server, &creds.server))
                        return(retval);
+               if (retval = krb5_copy_principal(client, &creds.client)) {
+                       krb5_free_principal(creds.server);
+                       return(retval);
+               }
                /* creds.times.endtime = 0; -- memset 0 takes care of this
                                        zero means "as long as possible" */
                /* creds.keyblock.keytype = 0; -- as well as this.