pull up r22474 from trunk
authorTom Yu <tlyu@mit.edu>
Tue, 29 Sep 2009 01:12:36 +0000 (01:12 +0000)
committerTom Yu <tlyu@mit.edu>
Tue, 29 Sep 2009 01:12:36 +0000 (01:12 +0000)
 ------------------------------------------------------------------------
 r22474 | epeisach | 2009-07-30 13:22:28 -0400 (Thu, 30 Jul 2009) | 7 lines

 ticket: 6541
 subject: Fix memory leak in k5_pac_verify_server_checksum

 k5_pac_verify_server_checksum was leaking memory when the checksum was valid.

 t_pac.c: Fix memory leak by forgetting to release memory.

ticket: 6541
version_fixed: 1.7.1
status: resolved

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

src/lib/krb5/krb/pac.c
src/lib/krb5/krb/t_pac.c

index 30a63bf3505f92d845f8562ff5574a8d36e81b4e..c5a7065624917601c0cae118d2e587bb7f3b96dd 100644 (file)
@@ -547,8 +547,10 @@ k5_pac_verify_server_checksum(krb5_context context,
 
     ret = krb5_c_verify_checksum(context, server, KRB5_KEYUSAGE_APP_DATA_CKSUM,
                                 &pac_data, &checksum, &valid);
+
+    free(pac_data.data);
+
     if (ret != 0) {
-       free(pac_data.data);
        return ret;
     }
 
index 527e3db22340578df061e9455a0147587b087b5b..503d778a9cfdc659e693e1e240a7bdb0cadbe8bb 100644 (file)
@@ -220,6 +220,8 @@ main(int argc, char **argv)
         if (ret)
             err(context, ret, "krb5_pac_verify 4");
         
+        krb5_free_data_contents(context, &data);
+
         krb5_pac_free(context, pac2);
     }