fix some confusion about when to release data
authorJohn Kohl <jtkohl@mit.edu>
Thu, 3 May 1990 18:31:14 +0000 (18:31 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 3 May 1990 18:31:14 +0000 (18:31 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@714 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/mk_req_ext.c

index bbfc4b2e09336582bf75af89483cdc0184b39f99..3108e7611b7b2d2d4a82a51ddc2c1678cd8a6092 100644 (file)
@@ -76,6 +76,7 @@ krb5_data *outbuf;
     krb5_data *scratch;
     krb5_enctype etype;
     krb5_encrypt_block eblock;
+    krb5_data *toutbuf;
 
     if ((ap_req_options & AP_OPTS_USE_SESSION_KEY) &&
        !creds->ticket.length)
@@ -110,9 +111,10 @@ krb5_data *outbuf;
     }
     /* encode it before encrypting */
     retval = encode_krb5_authenticator(&authent, &scratch);
-    cleanup_ticket();
-    if (retval)
+    if (retval) {
+       cleanup_ticket();
        return(retval);
+    }
 
 #define cleanup_scratch() { (void) bzero(scratch->data, scratch->length); krb5_free_data(scratch); }
 
@@ -152,10 +154,13 @@ krb5_data *outbuf;
        return retval;
     }
 
-    retval = encode_krb5_ap_req(&request, &outbuf);
+    if (!(retval = encode_krb5_ap_req(&request, &toutbuf))) {
+       *outbuf = *toutbuf;
+       xfree(toutbuf);
+    }
+    cleanup_ticket();
     cleanup_encpart();
-    if (retval)
-       return(retval);
+    return retval;
 
  clean_prockey:
     cleanup_prockey();