summaryrefslogtreecommitdiffstats
path: root/sys/rpc/clnt_dg.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-08-03 01:06:51 +0000
committerngie <ngie@FreeBSD.org>2016-08-03 01:06:51 +0000
commitbd38a253d7c8bab87a63fc12cace0b20ee4f3ad9 (patch)
tree22dbcc1d555bb8bb93963f74841dc86334965747 /sys/rpc/clnt_dg.c
parent747626849cf51886f0f6f0b255728b5fd4aedb28 (diff)
downloadFreeBSD-src-bd38a253d7c8bab87a63fc12cace0b20ee4f3ad9.zip
FreeBSD-src-bd38a253d7c8bab87a63fc12cace0b20ee4f3ad9.tar.gz
MFC r302550,r302551,r302552,r302553:
Approved by: re (gjb) r302550: Deobfuscate cleanup path in clnt_dg_create(..) Similar to r300836 and r301800, cl and cu will always be non-NULL as they're allocated using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`. Deobfuscating the cleanup path fixes a leak where if cl was NULL and cu was not, cu would not be free'd, and also removes a duplicate test for cl not being NULL. CID: 1007033, 1007344 r302551: Deobfuscate cleanup path in clnt_vc_create(..) Similar to r300836, r301800, and r302550, cl and ct will always be non-NULL as they're allocated using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`. CID: 1007342 r302552: Convert `svc_xprt_alloc(..)` and `svc_xprt_free(..)`'s prototypes to ANSI C style prototypes r302553: Don't test for xpt not being NULL before calling svc_xprt_free(..) svc_xprt_alloc(..) will always return initialized memory as it uses mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..). CID: 1007341
Diffstat (limited to 'sys/rpc/clnt_dg.c')
-rw-r--r--sys/rpc/clnt_dg.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/rpc/clnt_dg.c b/sys/rpc/clnt_dg.c
index 1f181fd..c82d270 100644
--- a/sys/rpc/clnt_dg.c
+++ b/sys/rpc/clnt_dg.c
@@ -313,11 +313,9 @@ recheck_socket:
cl->cl_netid = NULL;
return (cl);
err2:
- if (cl) {
- mem_free(cl, sizeof (CLIENT));
- if (cu)
- mem_free(cu, sizeof (*cu));
- }
+ mem_free(cl, sizeof (CLIENT));
+ mem_free(cu, sizeof (*cu));
+
return (NULL);
}
OpenPOWER on IntegriCloud