Skip to content

Commit

Permalink
Fix memory leaks in test programs
Browse files Browse the repository at this point in the history
Eliminate memory leaks detected by asan in test programs (and
introduced since commit 4947c27), to
make it easier to find more serious leaks.
  • Loading branch information
greghudson committed Mar 13, 2017
1 parent 0cff20b commit 8b1f9f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kdc/t_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/tests/icinterleave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 8b1f9f6

Please sign in to comment.