Move an error check to an earlier location in krb5_524_conv_principal
authorGreg Hudson <ghudson@mit.edu>
Fri, 1 May 2009 20:07:13 +0000 (20:07 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 1 May 2009 20:07:13 +0000 (20:07 +0000)
to fix a memory leak.

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

src/lib/krb5/krb/conv_princ.c

index 3247893bc236ddf6f099ddb5a986093b76bcfca8..43c588f0f68ff0602ed4cce7d7fb619fe03724a1 100644 (file)
@@ -156,6 +156,9 @@ krb5_524_conv_principal(krb5_context context, krb5_const_principal princ,
      unsigned int tmp_realm_len;
      int retval; 
 
+     if (context->profile == 0)
+         return KRB5_CONFIG_CANTOPEN;
+
      *name = *inst = '\0';
      switch (krb5_princ_size(context, princ)) {
      case 2:
@@ -218,8 +221,6 @@ krb5_524_conv_principal(krb5_context context, krb5_const_principal princ,
      /* Ask for v4_realm corresponding to 
        krb5 principal realm from krb5.conf realms stanza */
 
-     if (context->profile == 0)
-       return KRB5_CONFIG_CANTOPEN;
      retval = profile_get_string(context->profile, KRB5_CONF_REALMS,
                                 tmp_prealm, KRB5_CONF_V4_REALM, 0,
                                 &tmp_realm);