From 25452ebe24155c6f548bfc0d6840f6c34b5a4af3 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Wed, 18 Oct 2006 02:54:05 +0000 Subject: [PATCH] Memory leak fixes on exit git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18727 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/sample/sclient/sclient.c | 4 +++- src/appl/sample/sserver/sserver.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/appl/sample/sclient/sclient.c b/src/appl/sample/sclient/sclient.c index 46877211b..6ad305a88 100644 --- a/src/appl/sample/sclient/sclient.c +++ b/src/appl/sample/sclient/sclient.c @@ -90,7 +90,7 @@ net_read(fd, buf, len) int main(int argc, char *argv[]) { - struct addrinfo *ap, aihints; + struct addrinfo *ap, aihints, *apstart; int aierr; int sock; krb5_context context; @@ -152,6 +152,7 @@ main(int argc, char *argv[]) } /* set up the address of the foreign socket for connect() */ + apstart = ap; /* For freeing later */ for (sock = -1; ap && sock == -1; ap = ap->ai_next) { char abuf[NI_MAXHOST], pbuf[NI_MAXSERV]; char mbuf[NI_MAXHOST + NI_MAXSERV + 64]; @@ -248,6 +249,7 @@ main(int argc, char *argv[]) com_err(argv[0], 0, "no error or reply from sendauth!"); exit(1); } + freeaddrinfo(apstart); krb5_free_context(context); exit(0); } diff --git a/src/appl/sample/sserver/sserver.c b/src/appl/sample/sserver/sserver.c index 979b0ffd4..4bbcdda2d 100644 --- a/src/appl/sample/sserver/sserver.c +++ b/src/appl/sample/sserver/sserver.c @@ -231,6 +231,11 @@ main(argc, argv) syslog(LOG_ERR, "%m: while writing data to client"); exit(1); } + + krb5_free_ticket(context, ticket); + if(keytab) + krb5_kt_close(context, keytab); + krb5_free_principal(context, server); krb5_auth_con_free(context, auth_context); krb5_free_context(context); exit(0); -- 2.26.2