From: John Kohl Date: Tue, 30 Jan 1990 18:21:08 +0000 (+0000) Subject: (1) change to krb5_error_code X-Git-Tag: krb5-1.0-alpha2~1165 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f0b3abb16889510fd598f1d1a3ba85a1ac1f5f11;p=krb5.git (1) change to krb5_error_code (2) changes for new allocation strategy git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@218 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/os/localaddr.c b/src/lib/krb5/os/localaddr.c index 1b1acbf45..2c8fad177 100644 --- a/src/lib/krb5/os/localaddr.c +++ b/src/lib/krb5/os/localaddr.c @@ -76,7 +76,7 @@ extern int errno; * This uses the SIOCGIFCONF, SIOCGIFFLAGS, and SIOCGIFADDR ioctl's. */ -int krb5_os_localaddr(addr) +krb5_error_code krb5_os_localaddr(addr) krb5_address ***addr; { struct ifreq *ifr; @@ -130,13 +130,21 @@ int krb5_os_localaddr(addr) (struct sockaddr_in *)&ifr->ifr_addr; address = (krb5_address *) - malloc (sizeof(krb5_address) + sizeof(struct in_addr)); + malloc (sizeof(krb5_address)); if (address) { address->addrtype = ADDRTYPE_INET; address->length = sizeof(struct in_addr); - memcpy ((char *)address->contents, (char *)&in->sin_addr, - address->length); - break; + address->contents = (unsigned char *)malloc(address->length); + if (!address->contents) { + free((char *)address); + address = 0; + mem_err++; + } else { + memcpy ((char *)address->contents, + (char *)&in->sin_addr, + address->length); + break; + } } else mem_err++; } #endif