diff options
Diffstat (limited to 'contrib/bind9/lib/bind/irs')
-rw-r--r-- | contrib/bind9/lib/bind/irs/dns.c | 4 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/dns_ho.c | 22 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/gai_strerror.c | 25 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/gen_ho.c | 4 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/getaddrinfo.c | 34 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/gethostent.c | 4 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/getnameinfo.c | 10 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/getprotoent_r.c | 8 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/getservent_r.c | 16 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/irp.c | 7 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/irp_nw.c | 4 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/irpmarshall.c | 6 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/irs_data.c | 20 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/lcl_ho.c | 4 | ||||
-rw-r--r-- | contrib/bind9/lib/bind/irs/lcl_pr.c | 10 |
15 files changed, 112 insertions, 66 deletions
diff --git a/contrib/bind9/lib/bind/irs/dns.c b/contrib/bind9/lib/bind/irs/dns.c index ab83b3e..27529b5 100644 --- a/contrib/bind9/lib/bind/irs/dns.c +++ b/contrib/bind9/lib/bind/irs/dns.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: dns.c,v 1.1.206.2 2004/03/17 00:29:47 marka Exp $"; +static const char rcsid[] = "$Id: dns.c,v 1.1.206.3 2006/03/10 00:17:21 marka Exp $"; #endif /* @@ -114,7 +114,7 @@ dns_res_get(struct irs_acc *this) { res = (struct __res_state *)malloc(sizeof *res); if (res == NULL) return (NULL); - memset(dns->res, 0, sizeof *dns->res); + memset(res, 0, sizeof *res); dns_res_set(this, res, free); } diff --git a/contrib/bind9/lib/bind/irs/dns_ho.c b/contrib/bind9/lib/bind/irs/dns_ho.c index e8da61a..192be04 100644 --- a/contrib/bind9/lib/bind/irs/dns_ho.c +++ b/contrib/bind9/lib/bind/irs/dns_ho.c @@ -52,7 +52,7 @@ /* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.7.4.6 2005/10/11 00:48:14 marka Exp $"; +static const char rcsid[] = "$Id: dns_ho.c,v 1.5.2.7.4.8 2006/03/10 00:17:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* Imports. */ @@ -218,8 +218,7 @@ ho_close(struct irs_ho *this) { ho_minimize(this); if (pvt->res && pvt->free_res) (*pvt->free_res)(pvt->res); - if (pvt) - memput(pvt, sizeof *pvt); + memput(pvt, sizeof *pvt); memput(this, sizeof *this); } @@ -260,7 +259,7 @@ ho_byname2(struct irs_ho *this, const char *name, int af) errno = ENOMEM; goto cleanup; } - memset(q, 0, sizeof(q)); + memset(q, 0, sizeof(*q)); switch (af) { case AF_INET: @@ -352,8 +351,8 @@ ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) errno = ENOMEM; goto cleanup; } - memset(q, 0, sizeof(q)); - memset(q2, 0, sizeof(q2)); + memset(q, 0, sizeof(*q)); + memset(q2, 0, sizeof(*q2)); if (af == AF_INET6 && len == IN6ADDRSZ && (!memcmp(uaddr, mapped, sizeof mapped) || @@ -578,8 +577,8 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai) errno = ENOMEM; goto cleanup; } - memset(q, 0, sizeof(q2)); - memset(q2, 0, sizeof(q2)); + memset(q, 0, sizeof(*q2)); + memset(q2, 0, sizeof(*q2)); switch (pai->ai_family) { case AF_UNSPEC: @@ -649,10 +648,9 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai) if (ai) { querystate = RESQRY_SUCCESS; cur->ai_next = ai; - while (cur && cur->ai_next) + while (cur->ai_next) cur = cur->ai_next; - } - else + } else querystate = RESQRY_FAIL; } @@ -948,7 +946,7 @@ gethostans(struct irs_ho *this, continue; } if (ret_aip) { /* need addrinfo. keep it. */ - while (cur && cur->ai_next) + while (cur->ai_next) cur = cur->ai_next; } else if (cur->ai_next) { /* need hostent */ struct addrinfo *aip = cur->ai_next; diff --git a/contrib/bind9/lib/bind/irs/gai_strerror.c b/contrib/bind9/lib/bind/irs/gai_strerror.c index 6aeaaa1..0492f8f 100644 --- a/contrib/bind9/lib/bind/irs/gai_strerror.c +++ b/contrib/bind9/lib/bind/irs/gai_strerror.c @@ -66,18 +66,26 @@ gai_strerror(int ecode) { #ifdef DO_PTHREADS if (!once) { - pthread_mutex_lock(&lock); - if (!once++) - pthread_key_create(&key, free); - pthread_mutex_unlock(&lock); + if (pthread_mutex_lock(&lock) != 0) + goto unknown; + if (!once) { + if (pthread_key_create(&key, free) != 0) + goto unknown; + once = 1; + } + if (pthread_mutex_unlock(&lock) != 0) + goto unknown; } buf = pthread_getspecific(key); if (buf == NULL) { buf = malloc(EAI_BUFSIZE); if (buf == NULL) - return ("unknown error"); - pthread_setspecific(key, buf); + goto unknown; + if (pthread_setspecific(key, buf) != 0) { + free(buf); + goto unknown; + } } #endif /* @@ -86,4 +94,9 @@ gai_strerror(int ecode) { */ sprintf(buf, "%s: %d", gai_errlist[gai_nerr - 1], ecode); return (buf); + +#ifdef DO_PTHREADS + unknown: + return ("unknown error"); +#endif } diff --git a/contrib/bind9/lib/bind/irs/gen_ho.c b/contrib/bind9/lib/bind/irs/gen_ho.c index e9e2c89..f17aa22 100644 --- a/contrib/bind9/lib/bind/irs/gen_ho.c +++ b/contrib/bind9/lib/bind/irs/gen_ho.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: gen_ho.c,v 1.1.206.2 2004/03/17 01:49:39 marka Exp $"; +static const char rcsid[] = "$Id: gen_ho.c,v 1.1.206.3 2006/03/10 00:17:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* Imports */ @@ -371,8 +371,6 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai) } if (softerror != 0 && pvt->res->res_h_errno == HOST_NOT_FOUND) RES_SET_H_ERRNO(pvt->res, therrno); - if (rval) - freeaddrinfo(rval); return (NULL); } diff --git a/contrib/bind9/lib/bind/irs/getaddrinfo.c b/contrib/bind9/lib/bind/irs/getaddrinfo.c index d80f298..c8d1ab3 100644 --- a/contrib/bind9/lib/bind/irs/getaddrinfo.c +++ b/contrib/bind9/lib/bind/irs/getaddrinfo.c @@ -245,7 +245,7 @@ do { \ } while (/*CONSTCOND*/0) #ifndef SOLARIS2 -#define ERR(err) \ +#define SETERROR(err) \ do { \ /* external reference: error, and label bad */ \ error = (err); \ @@ -253,7 +253,7 @@ do { \ /*NOTREACHED*/ \ } while (/*CONSTCOND*/0) #else -#define ERR(err) \ +#define SETERROR(err) \ do { \ /* external reference: error, and label bad */ \ error = (err); \ @@ -352,16 +352,16 @@ getaddrinfo(hostname, servname, hints, res) /* error check for hints */ if (hints->ai_addrlen || hints->ai_canonname || hints->ai_addr || hints->ai_next) - ERR(EAI_BADHINTS); /* xxx */ + SETERROR(EAI_BADHINTS); /* xxx */ if (hints->ai_flags & ~AI_MASK) - ERR(EAI_BADFLAGS); + SETERROR(EAI_BADFLAGS); switch (hints->ai_family) { case PF_UNSPEC: case PF_INET: case PF_INET6: break; default: - ERR(EAI_FAMILY); + SETERROR(EAI_FAMILY); } memcpy(pai, hints, sizeof(*pai)); @@ -386,7 +386,7 @@ getaddrinfo(hostname, servname, hints, res) continue; if (pai->ai_socktype == ex->e_socktype && pai->ai_protocol != ex->e_protocol) { - ERR(EAI_BADHINTS); + SETERROR(EAI_BADHINTS); } } } @@ -406,7 +406,7 @@ getaddrinfo(hostname, servname, hints, res) case AI_ALL: #if 1 /* illegal */ - ERR(EAI_BADFLAGS); + SETERROR(EAI_BADFLAGS); #else pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED); break; @@ -434,7 +434,7 @@ getaddrinfo(hostname, servname, hints, res) } error = get_portmatch(pai, servname); if (error) - ERR(error); + SETERROR(error); *pai = ai0; } @@ -493,9 +493,9 @@ getaddrinfo(hostname, servname, hints, res) goto good; if (pai->ai_flags & AI_NUMERICHOST) - ERR(EAI_NONAME); + SETERROR(EAI_NONAME); if (hostname == NULL) - ERR(EAI_NONAME); + SETERROR(EAI_NONAME); /* * hostname as alphabetical name. @@ -576,10 +576,6 @@ getaddrinfo(hostname, servname, hints, res) freeaddrinfo(afai); /* afai must not be NULL at this point. */ - /* we must not have got any errors. */ - if (error != 0) /* just for diagnosis */ - abort(); - if (sentinel.ai_next) { good: *res = sentinel.ai_next; @@ -804,10 +800,10 @@ explore_numeric(pai, hostname, servname, res) pai->ai_family == PF_UNSPEC /*?*/) { GET_AI(cur->ai_next, afd, pton); GET_PORT(cur->ai_next, servname); - while (cur && cur->ai_next) + while (cur->ai_next) cur = cur->ai_next; } else - ERR(EAI_FAMILY); /*xxx*/ + SETERROR(EAI_FAMILY); /*xxx*/ } break; #endif @@ -817,10 +813,10 @@ explore_numeric(pai, hostname, servname, res) pai->ai_family == PF_UNSPEC /*?*/) { GET_AI(cur->ai_next, afd, pton); GET_PORT(cur->ai_next, servname); - while (cur && cur->ai_next) + while (cur->ai_next) cur = cur->ai_next; } else - ERR(EAI_FAMILY); /*xxx*/ + SETERROR(EAI_FAMILY); /*xxx*/ } break; } @@ -1202,7 +1198,7 @@ hostent2addrinfo(hp, pai) */ GET_CANONNAME(cur->ai_next, hp->h_name); } - while (cur && cur->ai_next) /* no need to loop, actually. */ + while (cur->ai_next) /* no need to loop, actually. */ cur = cur->ai_next; continue; diff --git a/contrib/bind9/lib/bind/irs/gethostent.c b/contrib/bind9/lib/bind/irs/gethostent.c index b471c52..cfea501 100644 --- a/contrib/bind9/lib/bind/irs/gethostent.c +++ b/contrib/bind9/lib/bind/irs/gethostent.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: gethostent.c,v 1.1.2.2.4.2 2004/03/17 01:49:40 marka Exp $"; +static const char rcsid[] = "$Id: gethostent.c,v 1.1.2.2.4.3 2006/01/10 05:09:16 marka Exp $"; #endif /* Imports */ @@ -608,7 +608,7 @@ scan_interfaces6(int *have_v4, int *have_v6) { } #endif -#ifdef __linux +#if ( defined(__linux__) || defined(__linux) || defined(LINUX) ) #ifndef IF_NAMESIZE # ifdef IFNAMSIZ # define IF_NAMESIZE IFNAMSIZ diff --git a/contrib/bind9/lib/bind/irs/getnameinfo.c b/contrib/bind9/lib/bind/irs/getnameinfo.c index 5947c03..d6d89f3 100644 --- a/contrib/bind9/lib/bind/irs/getnameinfo.c +++ b/contrib/bind9/lib/bind/irs/getnameinfo.c @@ -3,6 +3,16 @@ * - Thread safe-ness must be checked */ +#if ( defined(__linux__) || defined(__linux) || defined(LINUX) ) +#ifndef IF_NAMESIZE +# ifdef IFNAMSIZ +# define IF_NAMESIZE IFNAMSIZ +# else +# define IF_NAMESIZE 16 +# endif +#endif +#endif + /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. diff --git a/contrib/bind9/lib/bind/irs/getprotoent_r.c b/contrib/bind9/lib/bind/irs/getprotoent_r.c index 96bb4e3..58d0ec9 100644 --- a/contrib/bind9/lib/bind/irs/getprotoent_r.c +++ b/contrib/bind9/lib/bind/irs/getprotoent_r.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: getprotoent_r.c,v 1.3.206.1 2004/03/09 08:33:36 marka Exp $"; +static const char rcsid[] = "$Id: getprotoent_r.c,v 1.3.206.2 2006/08/01 01:19:28 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <port_before.h> @@ -109,6 +109,9 @@ setprotoent_r(int stay_open, PROTO_R_ENT_ARGS) setprotoent_r(int stay_open) #endif { +#ifdef PROTO_R_ENT_UNUSED + PROTO_R_ENT_UNUSED; +#endif setprotoent(stay_open); #ifdef PROTO_R_SET_RESULT return (PROTO_R_SET_RESULT); @@ -122,6 +125,9 @@ endprotoent_r(PROTO_R_ENT_ARGS) endprotoent_r() #endif { +#ifdef PROTO_R_ENT_UNUSED + PROTO_R_ENT_UNUSED; +#endif endprotoent(); PROTO_R_END_RESULT(PROTO_R_OK); } diff --git a/contrib/bind9/lib/bind/irs/getservent_r.c b/contrib/bind9/lib/bind/irs/getservent_r.c index b24f468..6dd7034 100644 --- a/contrib/bind9/lib/bind/irs/getservent_r.c +++ b/contrib/bind9/lib/bind/irs/getservent_r.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: getservent_r.c,v 1.3.206.1 2004/03/09 08:33:36 marka Exp $"; +static const char rcsid[] = "$Id: getservent_r.c,v 1.3.206.2 2006/08/01 01:19:28 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <port_before.h> @@ -112,7 +112,9 @@ setservent_r(int stay_open, SERV_R_ENT_ARGS) setservent_r(int stay_open) #endif { - +#ifdef SERV_R_ENT_UNUSED + SERV_R_ENT_UNUSED; +#endif setservent(stay_open); #ifdef SERV_R_SET_RESULT return (SERV_R_SET_RESULT); @@ -126,7 +128,9 @@ endservent_r(SERV_R_ENT_ARGS) endservent_r() #endif { - +#ifdef SERV_R_ENT_UNUSED + SERV_R_ENT_UNUSED; +#endif endservent(); SERV_R_END_RESULT(SERV_R_OK); } @@ -194,8 +198,8 @@ copy_servent(struct servent *se, struct servent *sptr, SERV_R_COPY_ARGS) { sptr->s_port = se->s_port; /* copy official name */ - cp = ndptr->line; - eob = ndptr->line + sizeof(ndptr->line); + cp = sdptr->line; + eob = sdptr->line + sizeof(sdptr->line); if ((n = strlen(se->s_name) + 1) < (eob - cp)) { strcpy(cp, se->s_name); sptr->s_name = cp; @@ -206,7 +210,7 @@ copy_servent(struct servent *se, struct servent *sptr, SERV_R_COPY_ARGS) { /* copy aliases */ i = 0; - sptr->s_aliases = ndptr->serv_aliases; + sptr->s_aliases = sdptr->serv_aliases; while (se->s_aliases[i] && i < (_MAXALIASES-1)) { if ((n = strlen(se->s_aliases[i]) + 1) < (eob - cp)) { strcpy(cp, se->s_aliases[i]); diff --git a/contrib/bind9/lib/bind/irs/irp.c b/contrib/bind9/lib/bind/irs/irp.c index e5620db..649079c 100644 --- a/contrib/bind9/lib/bind/irs/irp.c +++ b/contrib/bind9/lib/bind/irs/irp.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: irp.c,v 1.3.2.1.10.2 2004/03/17 01:49:41 marka Exp $"; +static const char rcsid[] = "$Id: irp.c,v 1.3.2.1.10.4 2006/03/10 00:17:21 marka Exp $"; #endif /* Imports */ @@ -425,6 +425,9 @@ irs_irp_read_body(struct irp_p *pvt, size_t *size) { char *buffer = memget(len); int idx = 0; + if (buffer == NULL) + return (NULL); + for (;;) { if (irs_irp_read_line(pvt, line, sizeof line) <= 0 || strchr(line, '\n') == NULL) @@ -517,7 +520,7 @@ irs_irp_get_full_response(struct irp_p *pvt, int *code, char *text, * int irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...); * * Sends command to remote connected via the PVT - * struture. FMT and args after it are fprintf-like + * structure. FMT and args after it are fprintf-like * arguments for formatting. * * Returns: diff --git a/contrib/bind9/lib/bind/irs/irp_nw.c b/contrib/bind9/lib/bind/irs/irp_nw.c index 346e5a4..ea68612 100644 --- a/contrib/bind9/lib/bind/irs/irp_nw.c +++ b/contrib/bind9/lib/bind/irs/irp_nw.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: irp_nw.c,v 1.1.206.1 2004/03/09 08:33:37 marka Exp $"; +static const char rcsid[] = "$Id: irp_nw.c,v 1.1.206.2 2006/03/10 00:17:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #if 0 @@ -319,6 +319,8 @@ nw_next(struct irs_nw *this) { nw = NULL; } + if (body != NULL) + memput(body, bodylen); return (nw); } diff --git a/contrib/bind9/lib/bind/irs/irpmarshall.c b/contrib/bind9/lib/bind/irs/irpmarshall.c index 6d2ebd4..198e349 100644 --- a/contrib/bind9/lib/bind/irs/irpmarshall.c +++ b/contrib/bind9/lib/bind/irs/irpmarshall.c @@ -49,7 +49,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: irpmarshall.c,v 1.3.206.3 2004/03/17 01:13:34 marka Exp $"; +static const char rcsid[] = "$Id: irpmarshall.c,v 1.3.206.4 2006/03/10 00:17:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #if 0 @@ -1020,7 +1020,7 @@ irp_unmarshall_ho(struct hostent *ho, char *buffer) { int hoaddrtype; int holength; long t; - char *name = NULL; + char *name; char **aliases = NULL; char **hohaddrlist = NULL; size_t hoaddrsize; @@ -1143,6 +1143,7 @@ irp_unmarshall_ho(struct hostent *ho, char *buffer) { errno = myerrno; if (name != NULL) free(name); + free_array(hohaddrlist, 0); free_array(aliases, 0); return (-1); @@ -1313,7 +1314,6 @@ irp_unmarshall_ng(const char **hostp, const char **userp, const char **domainp, if (host != NULL) free(host); if (user != NULL) free(user); - if (domain != NULL) free(domain); return (-1); } diff --git a/contrib/bind9/lib/bind/irs/irs_data.c b/contrib/bind9/lib/bind/irs/irs_data.c index f8e65ad..7904286 100644 --- a/contrib/bind9/lib/bind/irs/irs_data.c +++ b/contrib/bind9/lib/bind/irs/irs_data.c @@ -16,7 +16,7 @@ */ #if !defined(LINT) && !defined(CODECENTER) -static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.2.4.3 2004/11/30 01:15:43 marka Exp $"; +static const char rcsid[] = "$Id: irs_data.c,v 1.3.2.2.4.4 2006/03/10 00:17:21 marka Exp $"; #endif #include "port_before.h" @@ -128,10 +128,15 @@ net_data_init(const char *conf_file) { struct net_data *net_data; if (!once) { - pthread_mutex_lock(&keylock); - if (!once++) - pthread_key_create(&key, net_data_destroy); - pthread_mutex_unlock(&keylock); + if (pthread_mutex_lock(&keylock) != 0) + return (NULL); + if (!once) { + if (pthread_key_create(&key, net_data_destroy) != 0) + return (NULL); + once = 1; + } + if (pthread_mutex_unlock(&keylock) != 0) + return (NULL); } net_data = pthread_getspecific(key); #endif @@ -141,7 +146,10 @@ net_data_init(const char *conf_file) { if (net_data == NULL) return (NULL); #ifdef DO_PTHREADS - pthread_setspecific(key, net_data); + if (pthread_setspecific(key, net_data) != 0) { + net_data_destroy(net_data); + return (NULL); + } #endif } diff --git a/contrib/bind9/lib/bind/irs/lcl_ho.c b/contrib/bind9/lib/bind/irs/lcl_ho.c index 45d2677..b59a104 100644 --- a/contrib/bind9/lib/bind/irs/lcl_ho.c +++ b/contrib/bind9/lib/bind/irs/lcl_ho.c @@ -52,7 +52,7 @@ /* BIND Id: gethnamaddr.c,v 8.15 1996/05/22 04:56:30 vixie Exp $ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: lcl_ho.c,v 1.1.206.2 2004/03/17 00:29:50 marka Exp $"; +static const char rcsid[] = "$Id: lcl_ho.c,v 1.1.206.3 2006/03/10 00:17:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* Imports. */ @@ -541,7 +541,7 @@ ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai) ai = hostent2addrinfo(hp, pai); if (ai) { cur->ai_next = ai; - while (cur && cur->ai_next) + while (cur->ai_next) cur = cur->ai_next; } } diff --git a/contrib/bind9/lib/bind/irs/lcl_pr.c b/contrib/bind9/lib/bind/irs/lcl_pr.c index d8f909e..ddc92c8 100644 --- a/contrib/bind9/lib/bind/irs/lcl_pr.c +++ b/contrib/bind9/lib/bind/irs/lcl_pr.c @@ -49,7 +49,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: lcl_pr.c,v 1.1.206.1 2004/03/09 08:33:38 marka Exp $"; +static const char rcsid[] = "$Id: lcl_pr.c,v 1.1.206.2 2006/03/10 00:17:21 marka Exp $"; #endif /* LIBC_SCCS and not lint */ /* extern */ @@ -85,6 +85,7 @@ static const char rcsid[] = "$Id: lcl_pr.c,v 1.1.206.1 2004/03/09 08:33:38 marka struct pvt { FILE * fp; char line[BUFSIZ+1]; + char * dbuf; struct protoent proto; char * proto_aliases[MAXALIASES]; }; @@ -141,6 +142,8 @@ pr_close(struct irs_pr *this) { if (pvt->fp) (void) fclose(pvt->fp); + if (pvt->dbuf) + free(pvt->dbuf); memput(pvt, sizeof *pvt); memput(this, sizeof *this); } @@ -202,6 +205,10 @@ pr_next(struct irs_pr *this) { pr_rewind(this); if (!pvt->fp) return (NULL); + if (pvt->dbuf) { + free(pvt->dbuf); + pvt->dbuf = NULL; + } bufp = pvt->line; bufsiz = BUFSIZ; offset = 0; @@ -270,6 +277,7 @@ pr_next(struct irs_pr *this) { } } *q = NULL; + pvt->dbuf = dbuf; return (&pvt->proto); } |