From: Ezra Peisach Date: Tue, 16 Dec 2008 20:15:46 +0000 (+0000) Subject: Fix memory leaks in sam and ldap handler testing - there is still a leak w/ ldap X-Git-Tag: krb5-1.7-alpha1~159 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=531c97154416b556c710fa1472b17c58b163836f;p=krb5.git Fix memory leaks in sam and ldap handler testing - there is still a leak w/ ldap git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21479 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index 7111a7ece..4afc273c2 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -881,7 +881,9 @@ int main(argc, argv) setup(ldap_seqof_key_data,"ldap_seqof_key_data", ktest_make_sample_ldap_seqof_key_data); decode_run("ldap_seqof_key_data","","30 81 87 A0 03 02 01 01 A1 03 02 01 01 A2 03 02 01 2A A3 03 02 01 0E A4 71 30 6F 30 23 A0 10 30 0E A0 03 02 01 00 A1 07 04 05 73 61 6C 74 30 A1 0F 30 0D A0 03 02 01 02 A1 06 04 04 6B 65 79 30 30 23 A0 10 30 0E A0 03 02 01 01 A1 07 04 05 73 61 6C 74 31 A1 0F 30 0D A0 03 02 01 02 A1 06 04 04 6B 65 79 31 30 23 A0 10 30 0E A0 03 02 01 02 A1 07 04 05 73 61 6C 74 32 A1 0F 30 0D A0 03 02 01 02 A1 06 04 04 6B 65 79 32",acc.asn1_ldap_decode_sequence_of_keys,ktest_equal_ldap_sequence_of_keys,ktest_empty_ldap_seqof_key_data); + ktest_empty_ldap_seqof_key_data(test_context, &ref); } + #endif krb5_free_context(test_context); diff --git a/src/tests/asn.1/krb5_encode_test.c b/src/tests/asn.1/krb5_encode_test.c index ed056703c..2da5c1e7f 100644 --- a/src/tests/asn.1/krb5_encode_test.c +++ b/src/tests/asn.1/krb5_encode_test.c @@ -662,6 +662,7 @@ main(argc, argv) ktest_make_sample_enc_sam_response_enc); encode_run(sam_ch,krb5_enc_sam_response_enc,"enc_sam_response_enc","", encode_krb5_enc_sam_response_enc); + ktest_empty_enc_sam_response_enc(&sam_ch); } /****************************************************************/ /* encode_krb5_predicted_sam_response */ @@ -671,6 +672,7 @@ main(argc, argv) ktest_make_sample_predicted_sam_response); encode_run(sam_ch,krb5_predicted_sam_response,"predicted_sam_response","", encode_krb5_predicted_sam_response); + ktest_empty_predicted_sam_response(&sam_ch); } /****************************************************************/ /* encode_krb5_sam_response_2 */ diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c index 3418f2c49..5951b6c7e 100644 --- a/src/tests/asn.1/ktest.c +++ b/src/tests/asn.1/ktest.c @@ -1394,13 +1394,30 @@ void ktest_empty_sam_key(p) free(p->sam_key.contents); } +void ktest_empty_predicted_sam_response(p) + krb5_predicted_sam_response *p; +{ + ktest_empty_keyblock(&p->sam_key); + ktest_destroy_principal(&p->client); + ktest_empty_data(&p->msd); +} + +void ktest_empty_enc_sam_response_enc(p) + krb5_enc_sam_response_enc *p; +{ + ktest_empty_data(&p->sam_sad); +} + void ktest_empty_sam_response_2(p) krb5_sam_response_2 *p; { + ktest_empty_data(&p->sam_track_id); + ktest_empty_data(&p->sam_enc_nonce_or_sad.ciphertext); } void ktest_empty_enc_sam_response_enc_2(p) krb5_enc_sam_response_enc_2 *p; { + ktest_empty_data(&p->sam_sad); } #ifdef ENABLE_LDAP @@ -1413,5 +1430,6 @@ void ktest_empty_ldap_seqof_key_data(ctx, p) free(p->key_data[i].key_data_contents[0]); free(p->key_data[i].key_data_contents[1]); } + free(p->key_data); } #endif diff --git a/src/tests/asn.1/ktest.h b/src/tests/asn.1/ktest.h index b69481fc5..af7c9acc8 100644 --- a/src/tests/asn.1/ktest.h +++ b/src/tests/asn.1/ktest.h @@ -210,6 +210,8 @@ void ktest_empty_sam_challenge void ktest_empty_sam_response (krb5_sam_response * p); void ktest_empty_sam_key(krb5_sam_key *p); +void ktest_empty_enc_sam_response_enc(krb5_enc_sam_response_enc *p); +void ktest_empty_predicted_sam_response(krb5_predicted_sam_response *p); void ktest_empty_sam_response_2(krb5_sam_response_2 *p); void ktest_empty_enc_sam_response_enc_2(krb5_enc_sam_response_enc_2 *p);