[1197] in Kerberos-V5-bugs
krb5b4pl3: memory leak in lib/krb5/os/hst_realm.c
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Sun Mar 19 20:38:48 1995
From: "Jonathan I. Kamens" <jik@cam.ov.com>
Date: Sun, 19 Mar 1995 20:42:05 -0500
To: krb5-bugs@MIT.EDU
There's a memory leak in lib/krb5/os/hst_realm.c if gethostname()
fails. Here's a patch:
--- lib/krb5/os/hst_realm.c 1995/03/02 02:16:24 1.1
+++ lib/krb5/os/hst_realm.c 1995/03/02 02:17:48 1.2
@@ -96,8 +96,6 @@
char scanstring[7+2*16]; /* 7 chars + 16 for each decimal
conversion */
- if (!(retrealms = (char **)calloc(2, sizeof(*retrealms))))
- return ENOMEM;
if (!host) {
if (gethostname(local_host, sizeof(local_host)-1) == -1)
return errno;
@@ -105,6 +103,9 @@
host = local_host;
}
domain = strchr(host, '.');
+
+ if (!(retrealms = (char **)calloc(2, sizeof(*retrealms))))
+ return ENOMEM;
/* prepare default */
if (domain) {