From: Ezra Peisach Date: Wed, 25 Feb 1998 20:25:15 +0000 (+0000) Subject: * schpw.c (process_chpw_request): Free memory of allocated for X-Git-Tag: krb5-1.1-beta1~799 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebf30bc2f42f1cebb29130e4482a89ca1f1e9607;p=krb5.git * schpw.c (process_chpw_request): Free memory of allocated for local address. * ovsec_kadmd.c (do_schpw): Call krb5_kt_close to free memory allocated in keytab routines. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10474 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/server/ChangeLog b/src/kadmin/server/ChangeLog index d37f5ce1e..77cf0df94 100644 --- a/src/kadmin/server/ChangeLog +++ b/src/kadmin/server/ChangeLog @@ -1,3 +1,11 @@ +Wed Feb 25 14:00:32 1998 Ezra Peisach + + * schpw.c (process_chpw_request): Free memory of allocated for + local address. + + * ovsec_kadmd.c (do_schpw): Call krb5_kt_close to free memory + allocated. + Wed Feb 18 15:58:30 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/kadmin/server/ovsec_kadmd.c b/src/kadmin/server/ovsec_kadmd.c index bccdf9427..5a1c6b44c 100644 --- a/src/kadmin/server/ovsec_kadmd.c +++ b/src/kadmin/server/ovsec_kadmd.c @@ -907,7 +907,7 @@ void do_schpw(int s1, kadm5_config_params *params) if (connect(s2, (struct sockaddr *) &from, sizeof(from)) < 0) { krb5_klog_syslog(LOG_ERR, "chpw: Couldn't connect to client: %s", error_message(errno)); - return; + goto cleanup; } if (ret = process_chpw_request(context, global_server_handle, @@ -919,9 +919,10 @@ void do_schpw(int s1, kadm5_config_params *params) close(s2); - if (repdata.length == 0) + if (repdata.length == 0) { /* just qreturn. This means something really bad happened */ - return; + goto cleanup; + } len = sendto(s1, repdata.data, repdata.length, 0, (struct sockaddr *) &from, sizeof(from)); @@ -931,10 +932,13 @@ void do_schpw(int s1, kadm5_config_params *params) krb5_klog_syslog(LOG_ERR, "chpw: Error sending reply: %s", error_message(errno)); - return; + goto cleanup; } krb5_xfree(repdata.data); +cleanup: + krb5_kt_close(context, kt); + return; } diff --git a/src/kadmin/server/schpw.c b/src/kadmin/server/schpw.c index cb4a5de0d..c3901be92 100644 --- a/src/kadmin/server/schpw.c +++ b/src/kadmin/server/schpw.c @@ -20,6 +20,7 @@ process_chpw_request(context, server_handle, realm, s, keytab, sin, req, rep) char *ptr; int plen, vno; krb5_address local_kaddr, remote_kaddr; + int allocated_mem = 0; krb5_data ap_req, ap_rep; krb5_auth_context auth_context; krb5_principal changepw; @@ -149,6 +150,7 @@ process_chpw_request(context, server_handle, realm, s, keytab, sin, req, rep) local_kaddr.length = addrs[0]->length; local_kaddr.contents = malloc(addrs[0]->length); memcpy(local_kaddr.contents, addrs[0]->contents, addrs[0]->length); + allocated_mem++; krb5_free_addresses(context, addrs); } @@ -367,6 +369,8 @@ bailout: krb5_xfree(clear.data); if (cipher.length) krb5_xfree(cipher.data); + if (allocated_mem) + krb5_xfree(local_kaddr.contents); return(ret); }