krb5 commit: Fix memory leaks in test programs

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/91cd841086cdfbb7f171126ca132301123daf15e
commit 91cd841086cdfbb7f171126ca132301123daf15e
Author: Greg Hudson <[email protected]>
Date:   Sun Aug 5 19:00:33 2018 -0400

    Fix memory leaks in test programs
    
    Fix additional memory leaks detected by a newer asan (clang version
    6.0.0) in test programs.

 src/lib/krb5/krb/t_valid_times.c |    2 ++
 src/util/profile/prof_test1      |    1 +
 src/util/profile/profile_tcl.c   |    1 +
 3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/lib/krb5/krb/t_valid_times.c b/src/lib/krb5/krb/t_valid_times.c
index 1b469ff..e4b5f1b 100644
--- a/src/lib/krb5/krb/t_valid_times.c
+++ b/src/lib/krb5/krb/t_valid_times.c
@@ -105,5 +105,7 @@ main()
     ret = krb5int_validate_times(context, &times);
     assert(ret == KRB5KRB_AP_ERR_TKT_EXPIRED);
 
+    krb5_free_context(context);
+
     return 0;
 }
diff --git a/src/util/profile/prof_test1 b/src/util/profile/prof_test1
index 7d13c93..fc67571 100644
--- a/src/util/profile/prof_test1
+++ b/src/util/profile/prof_test1
@@ -360,6 +360,7 @@ proc test10 {} {
 	puts stderr "Error: test10: Did not find expected chores."
 	exit 1
     }
+    profile_release $p
 }
 
 test1
diff --git a/src/util/profile/profile_tcl.c b/src/util/profile/profile_tcl.c
index eb9950a..de61bae 100644
--- a/src/util/profile/profile_tcl.c
+++ b/src/util/profile/profile_tcl.c
@@ -2234,6 +2234,7 @@ _wrap_profile_get_string(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, i
     char *s = (arg6 && *arg6) ? *arg6 : "";
     Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
       Tcl_NewStringObj(s, strlen(s)));
+    profile_release_string(s);
   }
   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.