[krbdev.mit.edu #7086] potential memory leak in krb5int_get_fq_hostname

Arlene Berry via RT rt-comment at krbdev.mit.edu
Fri Feb 3 13:19:15 EST 2012


Krb5int_get_fq_hostname calls getaddrinfo but, if ai->ai_canonname is 0, it returns without freeing ai.

Index: src/lib/krb5/os/hst_realm.c
===================================================================
--- src/lib/krb5/os/hst_realm.c	(revision 25666)
+++ src/lib/krb5/os/hst_realm.c	(working copy)
@@ -112,7 +112,10 @@
     if (err)
         return krb5int_translate_gai_error (err);
     if (ai->ai_canonname == 0)
+    {
+        freeaddrinfo (ai);
         return KRB5_EAI_FAIL;
+    }
     strncpy (buf, ai->ai_canonname, bufsize);
     buf[bufsize-1] = 0;
     freeaddrinfo (ai);




More information about the krb5-bugs mailing list