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
This commit is contained in:
Martin Blapp 2006-09-09 22:26:47 +00:00
parent dc9fde8d4f
commit f340bd4070

View File

@ -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 @@ __rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
}
}
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);