aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Blapp <mbr@FreeBSD.org>2003-01-16 16:43:58 +0000
committerMartin Blapp <mbr@FreeBSD.org>2003-01-16 16:43:58 +0000
commit9790dbfc0fe5d8653f9dfb46ebdd6072e1e27405 (patch)
treef2837b424a866c8ee4dbc1e210f51080bae6b7fb
parent22b6d533cd3437e0b0f20aefb59f07f2d323d152 (diff)
downloadsrc-9790dbfc0fe5d8653f9dfb46ebdd6072e1e27405.tar.gz
src-9790dbfc0fe5d8653f9dfb46ebdd6072e1e27405.zip
Fix memleak.
Reviewed by: rwatson MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=109384
-rw-r--r--lib/libc/rpc/rpc_generic.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c
index 181392035672..180b5ee7eeb4 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;
}