From 4c67c4890093207155082610ba182ec32a28dde1 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Tue, 21 Oct 2008 21:50:52 +0000 Subject: [PATCH] Free data in tests so leaks checking is easier ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20903 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kim/test/test_kim_preferences.c | 14 ++++++++++++-- src/kim/test/test_kll.c | 10 +++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/kim/test/test_kim_preferences.c b/src/kim/test/test_kim_preferences.c index c364fc6fb..2766ad4d1 100644 --- a/src/kim/test/test_kim_preferences.c +++ b/src/kim/test/test_kim_preferences.c @@ -658,6 +658,8 @@ void test_kim_preferences_add_favorite_identity (kim_test_state_t state) log_failure (state, "Favorite identity %s not found in favorite identities list", fids[i].identity); } + + kim_identity_free (&identity); } if (!err && i != count) { @@ -841,6 +843,8 @@ void test_kim_preferences_remove_favorite_identity (kim_test_state_t state) log_failure (state, "Favorite identity %s not found in favorite identities list", fids[i].identity); } + + kim_identity_free (&identity); } if (!err && i != count) { @@ -855,7 +859,6 @@ void test_kim_preferences_remove_favorite_identity (kim_test_state_t state) if (!err) { kim_preferences prefs = NULL; kim_count count, j; - kim_string string; err = kim_preferences_create (&prefs); fail_if_error (state, "kim_preferences_create", err, @@ -870,6 +873,7 @@ void test_kim_preferences_remove_favorite_identity (kim_test_state_t state) for (j = 0; j < count; j++) { kim_identity compare_identity = NULL; kim_options compare_options = NULL; + kim_string string = NULL; err = kim_preferences_get_favorite_identity_at_index (prefs, 0, &compare_identity, @@ -878,7 +882,12 @@ void test_kim_preferences_remove_favorite_identity (kim_test_state_t state) "while getting favorite identity %d", (int) j); if (!err) { - kim_identity_get_display_string(compare_identity, &string); + err = kim_identity_get_display_string(compare_identity, &string); + fail_if_error (state, "kim_identity_get_display_string", err, + "while getting the display string for identity %d", (int) j); + } + + if (!err) { err = kim_preferences_remove_favorite_identity(prefs, compare_identity); fail_if_error (state, "kim_preferences_remove_favorite_identity", err, "while removing favorite identity %d \"%s\"", (int) j, string); @@ -897,6 +906,7 @@ void test_kim_preferences_remove_favorite_identity (kim_test_state_t state) display_string); } + kim_string_free (&string); kim_identity_free (&compare_identity); kim_options_free (&compare_options); } diff --git a/src/kim/test/test_kll.c b/src/kim/test/test_kll.c index 36b749f76..d1773ae30 100644 --- a/src/kim/test/test_kll.c +++ b/src/kim/test/test_kll.c @@ -55,28 +55,36 @@ void TestErrorHandling (void) char* errorString; err = KLGetErrorString (KRB5KRB_AP_ERR_BAD_INTEGRITY, &errorString); - printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klCredentialsBadAddressErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klCacheDoesNotExistErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klPasswordMismatchErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klInsecurePasswordErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klPasswordChangeFailedErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klCantContactServerErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } err = KLGetErrorString (klCantDisplayUIErr, &errorString); printf ("KLGetErrorString() returned %s (err = %ld)\n", errorString, err); + if (!err) { KLDisposeString (errorString); } } void TestHighLevelAPI (void) -- 2.26.2