krb5 commit: Stop misusing gss_release_buffer in test programs

Greg Hudson ghudson at MIT.EDU
Sat Aug 11 00:30:43 EDT 2012


https://github.com/krb5/krb5/commit/64903f771f8ca381013ec49fc2a5e5d69bf4bcff
commit 64903f771f8ca381013ec49fc2a5e5d69bf4bcff
Author: Greg Hudson <ghudson at mit.edu>
Date:   Sat Aug 11 00:17:50 2012 -0400

    Stop misusing gss_release_buffer in test programs
    
    Use free() instead of gss_release_buffer() when freeing the locally
    allocated context_token in the sample gss-server program.  Use
    gssalloc_free() instead of free when freeing buffers in
    t_kgss_kernel.c (where we can't use gss_release_buffer).

 src/appl/gss-sample/gss-server.c        |    2 +-
 src/util/gss-kernel-lib/t_kgss_kernel.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/appl/gss-sample/gss-server.c b/src/appl/gss-sample/gss-server.c
index 0f5fea0..ed78be5 100644
--- a/src/appl/gss-sample/gss-server.c
+++ b/src/appl/gss-sample/gss-server.c
@@ -382,7 +382,7 @@ test_import_export_context(gss_ctx_id_t *context)
     if (verbose && logfile)
         fprintf(logfile, "Importing context: %7.4f seconds\n",
                 timeval_subtract(&tm1, &tm2));
-    (void) gss_release_buffer(&min_stat, &context_token);
+    free(context_token.value);
     return 0;
 }
 
diff --git a/src/util/gss-kernel-lib/t_kgss_kernel.c b/src/util/gss-kernel-lib/t_kgss_kernel.c
index 890a7d9..bc961eb 100644
--- a/src/util/gss-kernel-lib/t_kgss_kernel.c
+++ b/src/util/gss-kernel-lib/t_kgss_kernel.c
@@ -110,7 +110,7 @@ read_wrap_token(gss_ctx_id_t ctx)
     major = krb5_gss_unwrap(&minor, ctx, &wrapped, &buf, NULL, NULL);
     check(major, minor, "krb5_gss_unwrap");
     assert(buf.length == 8 && memcmp(buf.value, "userwrap", 8) == 0);
-    free(buf.value);
+    gssalloc_free(buf.value);
     free(wrapped.value);
 }
 
@@ -178,7 +178,7 @@ send_wrap_token(gss_ctx_id_t ctx)
                           &wrapped);
     check(major, minor, "krb5_gss_wrap");
     send_data(STDOUT_FILENO, wrapped.value, wrapped.length);
-    free(wrapped.value);
+    gssalloc_free(wrapped.value);
 }
 
 /* Create a wrap token for the text "kernelmic" and send it to stdout. */
@@ -193,7 +193,7 @@ send_mic_token(gss_ctx_id_t ctx)
     major = krb5_gss_get_mic(&minor, ctx, GSS_C_QOP_DEFAULT, &buf, &mic);
     check(major, minor, "krb5_gss_get_mic");
     send_data(STDOUT_FILENO, mic.value, mic.length);
-    free(mic.value);
+    gssalloc_free(mic.value);
 }
 
 /* Create an IOV token for "kernelwrapmic", wrapping only the "wrap" part, and


More information about the cvs-krb5 mailing list