krb5 commit: Fix a minor memory leak in get_fq_hostname
Greg Hudson
ghudson at MIT.EDU
Tue Jul 3 15:27:08 EDT 2012
https://github.com/krb5/krb5/commit/ca58ab4f8665cf5f93e7a2b29844ec3cd1f2b5c7
commit ca58ab4f8665cf5f93e7a2b29844ec3cd1f2b5c7
Author: Arlene Berry <aberry at likewise.com>
Date: Tue Jul 3 15:20:54 2012 -0400
Fix a minor memory leak in get_fq_hostname
ticket: 7086
src/lib/krb5/os/hst_realm.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c
index 9266222..3665685 100644
--- a/src/lib/krb5/os/hst_realm.c
+++ b/src/lib/krb5/os/hst_realm.c
@@ -111,8 +111,10 @@ get_fq_hostname(char *buf, size_t bufsize, const char *name)
err = getaddrinfo (name, 0, &hints, &ai);
if (err)
return krb5int_translate_gai_error (err);
- if (ai->ai_canonname == 0)
+ if (ai->ai_canonname == NULL) {
+ freaddrinfo(ai);
return KRB5_EAI_FAIL;
+ }
strncpy (buf, ai->ai_canonname, bufsize);
buf[bufsize-1] = 0;
freeaddrinfo (ai);
More information about the cvs-krb5
mailing list