From 1b4987d8f3d988b34c2d7f5fa9f5ac1ce3083d32 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 13 Feb 2009 22:03:37 +0000 Subject: [PATCH] In krb5_decode_leak.c, work around the oddity that krb5_free_cred_enc_part is a contents-only free function. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22003 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/asn.1/krb5_decode_leak.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/tests/asn.1/krb5_decode_leak.c b/src/tests/asn.1/krb5_decode_leak.c index 4d40eec94..41045b5a8 100644 --- a/src/tests/asn.1/krb5_decode_leak.c +++ b/src/tests/asn.1/krb5_decode_leak.c @@ -22,6 +22,20 @@ krb5_context test_context; +/* + * Contrary to our usual convention, krb5_free_cred_enc_part is a + * contents-only free function (and is assumed to be by mk_cred and + * rd_cred) and we have no whole-structure free function for that data + * type. So create one here. + */ +static void +free_cred_enc_part_whole(krb5_context ctx, + krb5_cred_enc_part *val) +{ + krb5_free_cred_enc_part(ctx, val); + free(val); +} + int main(int argc, char **argv) { @@ -410,7 +424,7 @@ main(int argc, char **argv) setup(cep, "cred_enc_part", ktest_make_sample_cred_enc_part); leak_test(cep, encode_krb5_enc_cred_part, decode_krb5_enc_cred_part, - krb5_free_cred_enc_part); + free_cred_enc_part_whole); ktest_destroy_principal(&(cep.ticket_info[0]->client)); ktest_destroy_principal(&(cep.ticket_info[0]->server)); @@ -425,7 +439,7 @@ main(int argc, char **argv) ktest_destroy_address(&(cep.s_address)); ktest_destroy_address(&(cep.r_address)); leak_test(cep, encode_krb5_enc_cred_part, decode_krb5_enc_cred_part, - krb5_free_cred_enc_part); + free_cred_enc_part_whole); ktest_empty_cred_enc_part(&cep); } -- 2.26.2