pull up r23834 from trunk
authorTom Yu <tlyu@mit.edu>
Tue, 23 Mar 2010 22:31:00 +0000 (22:31 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 23 Mar 2010 22:31:00 +0000 (22:31 +0000)
 ------------------------------------------------------------------------
 r23834 | tlyu | 2010-03-23 15:00:13 -0700 (Tue, 23 Mar 2010) | 7 lines

 ticket: 6678
 target_version: 1.8.1
 tags: pullup

 Apply patch from Arlene Berry to not use freed memory in
 gss_import_sec_context in some error paths.

ticket: 6678
version_fixed: 1.8.1
status: resolved

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-8@23835 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/import_sec_context.c

index d4ef1e345a0887e98c150102b9b106602693bcde..30ec2309e9356c301126f79ebb069e05f7c325ea 100644 (file)
@@ -106,12 +106,13 @@ krb5_gss_import_sec_context(minor_status, interprocess_token, context_handle)
     ibp = (krb5_octet *) interprocess_token->value;
     blen = (size_t) interprocess_token->length;
     kret = kg_ctx_internalize(context, (krb5_pointer *) &ctx, &ibp, &blen);
-    krb5_free_context(context);
     if (kret) {
         *minor_status = (OM_uint32) kret;
         save_error_info(*minor_status, context);
+        krb5_free_context(context);
         return(GSS_S_FAILURE);
     }
+    krb5_free_context(context);
 
     /* intern the context handle */
     if (! kg_save_ctx_id((gss_ctx_id_t) ctx)) {