Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jul 2016 20:30:20 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r302451 - stable/10/sys/rpc
Message-ID:  <201607082030.u68KUKV7050285@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607082030.u68KUKV7050285>