Fix memory leak in k5_pac_verify_server_checksum
authorEzra Peisach <epeisach@mit.edu>
Thu, 30 Jul 2009 17:22:28 +0000 (17:22 +0000)
committerEzra Peisach <epeisach@mit.edu>
Thu, 30 Jul 2009 17:22:28 +0000 (17:22 +0000)
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

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22474 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);
     }