From 47227ef0ef663b7abb81ab5a60a450da9a93d24b Mon Sep 17 00:00:00 2001 From: Martin Blapp Date: Thu, 16 Jan 2003 16:56:22 +0000 Subject: MFC: Fix memleak. Reviewed by: rwatson Approved by: re (scottl) --- lib/libc/rpc/rpc_generic.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c index 1813920356723..180b5ee7eeb49 100644 --- a/lib/libc/rpc/rpc_generic.c +++ b/lib/libc/rpc/rpc_generic.c @@ -555,21 +555,27 @@ int __rpc_sockinfo2netid(struct __rpc_sockinfo *sip, const char **netid) { int i; + struct netconfig *nconf; + + nconf = getnetconfigent("local"); for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++) { if (na_cvt[i].af == sip->si_af && na_cvt[i].protocol == sip->si_proto) { - if (strcmp(na_cvt[i].netid, "local") == 0 && - getnetconfigent("local") == NULL) { + if (strcmp(na_cvt[i].netid, "local") == 0 && nconf == NULL) { if (netid) *netid = "unix"; } else { if (netid) *netid = na_cvt[i].netid; } + if (nconf != NULL) + freenetconfigent(nconf); return 1; } } + if (nconf != NULL) + freenetconfigent(nconf); return 0; } -- cgit v1.2.3