svn commit: r302451 - stable/10/sys/rpc
Garrett Cooper
ngie at FreeBSD.org
Fri Jul 8 20:30:21 UTC 2016
Author: ngie
Date: Fri Jul 8 20:30:20 2016
New Revision: 302451
URL: https://svnweb.freebsd.org/changeset/base/302451
Log:
MFC r301800:
Deobfuscate cleanup path in clnt_bck_create(..)
Similar to r300836, cl and ct 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
ct was not, ct would not be free'd, and also removes a duplicate test for
cl not being NULL.
CID: 1229999
Modified:
stable/10/sys/rpc/clnt_bck.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/rpc/clnt_bck.c
==============================================================================
--- stable/10/sys/rpc/clnt_bck.c Fri Jul 8 20:20:46 2016 (r302450)
+++ stable/10/sys/rpc/clnt_bck.c Fri Jul 8 20:30:20 2016 (r302451)
@@ -175,14 +175,9 @@ clnt_bck_create(
return (cl);
err:
- if (cl) {
- if (ct) {
- mtx_destroy(&ct->ct_lock);
- mem_free(ct, sizeof (struct ct_data));
- }
- if (cl)
- mem_free(cl, sizeof (CLIENT));
- }
+ mtx_destroy(&ct->ct_lock);
+ mem_free(ct, sizeof (struct ct_data));
+ mem_free(cl, sizeof (CLIENT));
return (NULL);
}
More information about the svn-src-stable-10
mailing list