pull up r20480 from trunk
authorTom Yu <tlyu@mit.edu>
Mon, 14 Jul 2008 22:13:19 +0000 (22:13 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 14 Jul 2008 22:13:19 +0000 (22:13 +0000)
 r20480@cathode-dark-space:  raeburn | 2008-06-26 21:26:08 -0400
 ticket: new
 subject: fix free of automatic storage
 target_version: 1.6.4
 tags: pullup

 Fix a possible free of automatic storage that can happen on an
 (unlikely) encoding failure.

ticket: 5996
version_fixed: 1.6.4

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

src/lib/krb5/krb/rd_safe.c

index 15dc6dcccd6923fad9831826e567f6c4f6a72cb5..a9de1194070c20238a13157908c269745c5a9d8c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * lib/krb5/krb/rd_safe.c
  *
- * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991,2007,2008 by the Massachusetts Institute of Technology.
  * All Rights Reserved.
  *
  * Export of this software from the United States of America may
@@ -114,11 +114,11 @@ krb5_rd_safe_basic(krb5_context context, const krb5_data *inbuf, const krb5_keyb
 
     message->checksum = &our_cksum;
 
-    if ((retval = encode_krb5_safe_with_body(message, &safe_body, &scratch)))
+    retval = encode_krb5_safe_with_body(message, &safe_body, &scratch);
+    message->checksum = his_cksum;
+    if (retval)
        goto cleanup;
 
-    message->checksum = his_cksum;
-                        
     retval = krb5_c_verify_checksum(context, keyblock,
                                    KRB5_KEYUSAGE_KRB_SAFE_CKSUM,
                                    scratch, his_cksum, &valid);