diff options
author | Greg Hudson <ghudson@mit.edu> | 2016-06-23 11:12:55 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2016-08-10 17:24:05 -0400 |
commit | 4947c270032691d556140b290e1b10846b692968 (patch) | |
tree | fd967c980c98b3e8977a81b9c3ce2a6df2441bf8 /src/plugins/preauth/pkinit/pkinit_kdf_test.c | |
parent | 73c9944ae86cf3a89e11d3d3f15dd9b8da7b9cd1 (diff) | |
download | krb5-4947c270032691d556140b290e1b10846b692968.zip krb5-4947c270032691d556140b290e1b10846b692968.tar.gz krb5-4947c270032691d556140b290e1b10846b692968.tar.bz2 |
Fix memory leaks in test programs
Eliminate memory leaks detected by asan in test programs, to make it
easier to find more serious leaks.
Diffstat (limited to 'src/plugins/preauth/pkinit/pkinit_kdf_test.c')
-rw-r--r-- | src/plugins/preauth/pkinit/pkinit_kdf_test.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/plugins/preauth/pkinit/pkinit_kdf_test.c b/src/plugins/preauth/pkinit/pkinit_kdf_test.c index afc6029..7acbd0d 100644 --- a/src/plugins/preauth/pkinit/pkinit_kdf_test.c +++ b/src/plugins/preauth/pkinit/pkinit_kdf_test.c @@ -82,11 +82,9 @@ main(int argc, char **argv) /* other local variables */ int retval = 0; - int max_keylen = 2048; krb5_enctype enctype = 0; krb5_principal u_principal = NULL; krb5_principal v_principal = NULL; - krb5_keyblock *key_block_ptr = &key_block; /* initialize variables that get malloc'ed, so cleanup is safe */ krb5_init_context (&context); @@ -130,15 +128,6 @@ main(int argc, char **argv) enctype = enctype_aes; - /* set-up the key_block */ - if (0 != (retval = krb5_init_keyblock(context, enctype, max_keylen, - &key_block_ptr))) { - printf("ERROR in pkinit_kdf_test: can't init keyblock, retval = %d", - retval); - goto cleanup; - - } - /* call pkinit_alg_agility_kdf() with test vector values*/ if (0 != (retval = pkinit_alg_agility_kdf(context, &secret, &alg_id.algorithm, @@ -171,15 +160,6 @@ main(int argc, char **argv) enctype = enctype_aes; - /* set-up the key_block */ - if (0 != (retval = krb5_init_keyblock(context, enctype, max_keylen, - &key_block_ptr))) { - printf("ERROR in pkinit_kdf_test: can't init keyblock, retval = %d", - retval); - goto cleanup; - - } - /* call pkinit_alg_agility_kdf() with test vector values*/ if (0 != (retval = pkinit_alg_agility_kdf(context, &secret, &alg_id.algorithm, @@ -212,15 +192,6 @@ main(int argc, char **argv) enctype = enctype_des3; - /* set-up the key_block */ - if (0 != (retval = krb5_init_keyblock(context, enctype, max_keylen, - &key_block_ptr))) { - printf("ERROR in pkinit_kdf_test: can't init keyblock, retval = %d", - retval); - goto cleanup; - - } - /* call pkinit_alg_agility_kdf() with test vector values*/ if (0 != (retval = pkinit_alg_agility_kdf(context, &secret, &alg_id.algorithm, @@ -247,8 +218,8 @@ main(int argc, char **argv) cleanup: /* release all allocated resources, whether good or bad return */ free(secret.data); - free(u_principal); - free(v_principal); + krb5_free_principal(context, u_principal); + krb5_free_principal(context, v_principal); krb5_free_keyblock_contents(context, &key_block); exit(retval); } |