fix free of automatic storage
authorKen Raeburn <raeburn@mit.edu>
Fri, 27 Jun 2008 01:26:08 +0000 (01:26 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 27 Jun 2008 01:26:08 +0000 (01:26 +0000)
Fix a possible free of automatic storage that can happen on an
(unlikely) encoding failure.

ticket: new
target_version: 1.6.4
tags: pullup

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

src/lib/krb5/krb/rd_safe.c

index 3eae17269c7aa77fd841634c67a3539a5d1721b3..021fd803e8ee33b7897c006ab04a66806b7b2794 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * lib/krb5/krb/rd_safe.c
  *
- * Copyright 1990,1991,2007 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
@@ -116,11 +116,11 @@ krb5_rd_safe_basic(krb5_context context, const krb5_data *inbuf,
 
     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);