From: Tom Yu Date: Mon, 5 Dec 2011 23:43:25 +0000 (+0000) Subject: pull up r25498 from trunk X-Git-Tag: krb5-1.10-alpha2~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9a3efb29cdf08d8d70f5355dc7c86126addfd0ce;p=krb5.git pull up r25498 from trunk ------------------------------------------------------------------------ r25498 | hartmans | 2011-12-02 13:52:22 -0500 (Fri, 02 Dec 2011) | 8 lines ticket: 7036 subject: Fix free ofuninitialized memory in sname_to_princ tags: pullup Target_Version: 1.10 Fix free of uninitialized memory in error case introduced in 1.10 development cycle. ticket: 7036 version_fixed: 1.10 status: resolved git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-10@25521 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/sn2princ.c b/src/lib/krb5/os/sn2princ.c index 8f8a0ce8e..1bee5ae81 100644 --- a/src/lib/krb5/os/sn2princ.c +++ b/src/lib/krb5/os/sn2princ.c @@ -90,7 +90,7 @@ krb5_sname_to_principal(krb5_context context, const char *hostname, const char * /* copy the hostname into non-volatile storage */ if (type == KRB5_NT_SRV_HST) { - struct addrinfo *ai, hints; + struct addrinfo *ai = NULL, hints; int err; char hnamebuf[NI_MAXHOST]; @@ -114,7 +114,8 @@ krb5_sname_to_principal(krb5_context context, const char *hostname, const char * } remote_host = strdup((ai && ai->ai_canonname) ? ai->ai_canonname : hostname); if (!remote_host) { - freeaddrinfo(ai); + if(ai) + freeaddrinfo(ai); return ENOMEM; }