summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2006-09-09 22:26:47 +0000
committermbr <mbr@FreeBSD.org>2006-09-09 22:26:47 +0000
commitf5fc251a2597d700a49e766ac864f1c40aebf56c (patch)
tree64489a532933889dfa844694c85f8385c3bb90a1 /lib
parenta71d32ed3cb35248d2a8807363bab8436dd2817c (diff)
downloadFreeBSD-src-f5fc251a2597d700a49e766ac864f1c40aebf56c.zip
FreeBSD-src-f5fc251a2597d700a49e766ac864f1c40aebf56c.tar.gz
Sync with NetBSD rev. 1.20 + 1.21
Coverity CID 2284: Fix multiple memory leaks. Coverity CID 710: Remove unreachable code. MFC after: 1 month
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/rpcb_clnt.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c
index ac34c34..aa9d6ed 100644
--- a/lib/libc/rpc/rpcb_clnt.c
+++ b/lib/libc/rpc/rpcb_clnt.c
@@ -239,11 +239,21 @@ add_cache(host, netid, taddr, uaddr)
ad_cache->ac_taddr = (struct netbuf *)malloc(sizeof (struct netbuf));
if (!ad_cache->ac_host || !ad_cache->ac_netid || !ad_cache->ac_taddr ||
(uaddr && !ad_cache->ac_uaddr)) {
- return;
+ goto out;
}
ad_cache->ac_taddr->len = ad_cache->ac_taddr->maxlen = taddr->len;
ad_cache->ac_taddr->buf = (char *) malloc(taddr->len);
if (ad_cache->ac_taddr->buf == NULL) {
+out:
+ if (ad_cache->ac_host)
+ free(ad_cache->ac_host);
+ if (ad_cache->ac_netid)
+ free(ad_cache->ac_netid);
+ if (ad_cache->ac_uaddr)
+ free(ad_cache->ac_uaddr);
+ if (ad_cache->ac_taddr)
+ free(ad_cache->ac_taddr);
+ free(ad_cache);
return;
}
memcpy(ad_cache->ac_taddr->buf, taddr->buf, taddr->len);
@@ -1012,11 +1022,6 @@ regular_rpcbind:
}
}
- if ((address == NULL) || (address->len == 0)) {
- rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
- clnt_geterr(client, &rpc_createerr.cf_error);
- }
-
error:
if (client) {
CLNT_DESTROY(client);
OpenPOWER on IntegriCloud