krb5 commit: Fix memory leaks in test programs
Greg Hudson
ghudson at mit.edu
Mon Mar 13 13:01:36 EDT 2017
https://github.com/krb5/krb5/commit/8b1f9f64159add28ab03a35a7a98f9f17664322f
commit 8b1f9f64159add28ab03a35a7a98f9f17664322f
Author: Greg Hudson <ghudson at mit.edu>
Date: Sun Mar 12 12:29:50 2017 -0400
Fix memory leaks in test programs
Eliminate memory leaks detected by asan in test programs (and
introduced since commit 4947c270032691d556140b290e1b10846b692968), to
make it easier to find more serious leaks.
src/kdc/t_replay.c | 6 ++++++
src/tests/icinterleave.c | 4 ++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/kdc/t_replay.c b/src/kdc/t_replay.c
index 87dbbc6..fe49560 100644
--- a/src/kdc/t_replay.c
+++ b/src/kdc/t_replay.c
@@ -620,6 +620,8 @@ test_kdc_check_lookaside_hit(void **state)
assert_true(data_eq(rep, *result_data));
assert_int_equal(hits, 1);
assert_int_equal(e->num_hits, 1);
+
+ krb5_free_data(context, result_data);
}
static void
@@ -697,6 +699,8 @@ test_kdc_check_lookaside_hit_multiple(void **state)
assert_int_equal(e1->num_hits, 1);
assert_int_equal(e2->num_hits, 0);
+ krb5_free_data(context, result_data);
+
/* Set result_data so we can verify that it is reset to NULL. */
result_data = &req1;
result = kdc_check_lookaside(context, &req2, &result_data);
@@ -730,6 +734,8 @@ test_kdc_check_lookaside_hit_hash_collision(void **state)
assert_int_equal(e1->num_hits, 1);
assert_int_equal(e2->num_hits, 0);
+ krb5_free_data(context, result_data);
+
/* Set result_data so we can verify that it is reset to NULL. */
result_data = &req1;
result = kdc_check_lookaside(context, &req2, &result_data);
diff --git a/src/tests/icinterleave.c b/src/tests/icinterleave.c
index d76ecf3..a1bdd35 100644
--- a/src/tests/icinterleave.c
+++ b/src/tests/icinterleave.c
@@ -119,6 +119,10 @@ main(int argc, char **argv)
}
}
+ for (i = 0; i < nclients; i++)
+ krb5_free_data_contents(ctx, &reps[i]);
+ free(reps);
+ free(iccs);
krb5_free_context(ctx);
return 0;
}
More information about the cvs-krb5
mailing list